pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
print.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_FUNCTIONS_PRINT_H
4#define pRC_CORE_BASIC_FUNCTIONS_PRINT_H
5
6#include <cstdio>
7
14
15namespace pRC
16{
17 template<Size N>
18 static inline auto print(String<N> const &string, std::FILE *stream)
19 {
21 [&string, &stream](auto const i)
22 {
23 if(string[i] != '\0')
24 {
25 std::fputc(string[i], stream);
26 }
27 });
28 }
29
30 template<class T, T... Is, class S>
31 static inline auto print(Sequence<T, Is...> const, S &&stream)
32 {
34 }
35
36 template<Size... Ns, class S>
37 static inline auto print(Sizes<Ns...> const, S &&stream)
38 {
40 }
41
42 template<class S>
43 static inline auto print(Direction const direction, S &&stream)
44 {
45 switch(direction)
46 {
48 print("pRC::Direction::Leftwards", stream);
49 break;
51 print("pRC::Direction::Rightwards", stream);
52 break;
54 print("pRC::Direction::Upwards", stream);
55 break;
57 print("pRC::Direction::Downwards", stream);
58 break;
60 print("pRC::Direction::Forwards", stream);
61 break;
63 print("pRC::Direction::Backwards", stream);
64 break;
65 default:
66 print("pRC::Direction::Unknown", stream);
67 break;
68 }
69 }
70
71 template<class S>
72 static inline auto print(Context const context, S &&stream)
73 {
74 switch(context)
75 {
77 print("pRC::Context::CompileTime", stream);
78 break;
80 print("pRC::Context::RunTime", stream);
81 break;
82 default:
83 print("pRC::Context::Unknown", stream);
84 break;
85 }
86 }
87}
88#endif // pRC_CORE_BASIC_FUNCTIONS_PRINT_H
Definition sequence.hpp:56
Definition sequence.hpp:34
Definition string.hpp:19
Definition cholesky.hpp:18
static auto print(String< N > const &string, std::FILE *stream)
Definition print.hpp:18
std::size_t Size
Definition type_traits.hpp:20
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto name()
Definition type_name.hpp:11
Context
Definition context.hpp:9
Direction
Definition direction.hpp:9