blob: 4b9ba7b007262f634f4b65ccbea90f0244b84972 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#ifndef PYTHONIC_BUILTIN_PRINT_HPP
#define PYTHONIC_BUILTIN_PRINT_HPP
#include "pythonic/include/builtins/print.hpp"
#include "pythonic/utils/functor.hpp"
#include <iostream>
PYTHONIC_NS_BEGIN
namespace builtins
{
namespace details
{
template <class T>
std::ostream &print(std::ostream &os, T const &t)
{
return os << t;
}
inline std::ostream &print(std::ostream &os, bool const &t)
{
static char const repr[2][6] = {"False", "True\0"};
return os << repr[t];
}
} // namespace details
inline void print_nonl()
{
}
template <typename T, typename... Types>
void print_nonl(T const &value, Types const &...values)
{
details::print(std::cout, value);
if (sizeof...(Types) > 0)
std::cout << ' ';
print_nonl(values...);
}
inline void print()
{
std::cout << std::endl;
}
template <typename T, typename... Types>
void print(T const &value, Types const &...values)
{
details::print(std::cout, value);
if (sizeof...(values) > 0)
std::cout << ' ';
print(values...);
}
} // namespace builtins
PYTHONIC_NS_END
#endif
|