29 std::ostream &
operator<<(std::ostream &s,
const std::complex<T> &c) {
30 s << c.real() << (c.imag() >= 0 ?
"+" :
"") << c.imag() <<
"j";
41 template <
typename T,
typename U>
42 std::ostream &
operator<<(std::ostream &s,
const std::pair<T, U> &p) {
54 std::ostream &
operator<<(std::ostream &s,
const std::vector<T> &c) {
56 typename std::vector<T>::const_iterator it = c.begin();
57 while (it != c.end()) {
75 template <
typename T, std::
size_t N>
76 typename std::enable_if<!std::is_same<T, char>::value, std::ostream &>::type
77 operator<<(std::ostream &s,
const std::array<T,N>& v) {
79 for (std::size_t i = 0; i < N; ++i) {
96 template <
typename T, std::
size_t N>
97 typename std::enable_if<!std::is_same<T, char>::value, std::ostream &>::type
100 for (std::size_t i = 0; i < N; ++i) {
113 template <
typename T,
typename... Ts>
114 inline std::ostream &
print_helper(std::ostream &out,
const T &t,
const Ts &... ts) {
115 using ttg::iostream::operator<<;
121 template <StdOstreamTag>
123 static std::mutex mutex;
129 template <
typename T,
typename... Ts>
130 void print(
const T &t,
const Ts &... ts) {
131 std::lock_guard<std::mutex> lock(detail::print_mutex_accessor<detail::StdOstreamTag::Cout>());
137 template <
typename T,
typename... Ts>
139 std::lock_guard<std::mutex> lock(detail::print_mutex_accessor<detail::StdOstreamTag::Cout>());
145 template <
typename T,
typename... Ts>
146 void log(
const T &t,
const Ts &... ts) {
147 std::lock_guard<std::mutex> lock(detail::print_mutex_accessor<detail::StdOstreamTag::Cout>());
std::ostream & print_helper(std::ostream &out)
std::mutex & print_mutex_accessor()
std::ostream & operator<<(std::ostream &s, const std::complex< T > &c)
default printing of std::complex
top-level TTG namespace contains runtime-neutral functionality
constexpr char print_seq_separator
void print(const T &t, const Ts &... ts)
atomically prints to std::cout a sequence of items (separated by ttg::print_separator) followed by st...
constexpr char print_separator
void log(const T &t, const Ts &... ts)
atomically prints to std::clog a sequence of items (separated by ttg::print_separator) followed by st...
void print_error(const T &t, const Ts &... ts)
atomically prints to std::cerr a sequence of items (separated by ttg::print_separator) followed by st...
constexpr char print_seq_end
constexpr char print_seq_begin