24 #ifndef PXR_BASE_TF_OSTREAM_METHODS_H
25 #define PXR_BASE_TF_OSTREAM_METHODS_H
42 #include "pxr/base/tf/hashmap.h"
50 #include <type_traits>
52 #include <boost/type_traits/has_left_shift.hpp>
54 PXR_NAMESPACE_OPEN_SCOPE
57 constexpr
bool Tf_IsOstreamable() {
58 return boost::has_left_shift<
59 std::ostream &, T, std::ostream &>::value;
64 template <
class T, u
int32_t N>
65 typename std::enable_if<PXR_NS::Tf_IsOstreamable<T>(), std::ostream &>::type
69 for (
auto const &obj: v)
76 PXR_NAMESPACE_CLOSE_SCOPE
85 typename std::enable_if<PXR_NS::Tf_IsOstreamable<T>(), std::ostream &>::type
86 operator<<(std::ostream &out,
const std::vector<T> &v)
89 for (
auto const &obj: v)
99 typename std::enable_if<PXR_NS::Tf_IsOstreamable<T>(), std::ostream &>::type
100 operator<<(std::ostream &out,
const std::set<T> &v)
103 for (
auto const &obj: v)
113 typename std::enable_if<PXR_NS::Tf_IsOstreamable<T>(), std::ostream &>::type
114 operator<<(std::ostream &out,
const std::list<T> &l)
117 for (
auto const &obj: l)
126 template <
class K,
class M,
class H,
class C,
class A>
127 typename std::enable_if<
128 PXR_NS::Tf_IsOstreamable<K>() && PXR_NS::Tf_IsOstreamable<M>(), std::ostream &>::type
129 operator<<(std::ostream &out, const PXR_NS::TfHashMap<K, M, H, C, A> &h)
132 for (
auto const &p: h)
133 out <<
"<" << p.first <<
": " << p.second <<
"> ";
140 template <
class K,
class M>
141 typename std::enable_if<
142 PXR_NS::Tf_IsOstreamable<K>() && PXR_NS::Tf_IsOstreamable<M>(), std::ostream &>::type
143 operator<<(std::ostream &out, const std::map<K, M> &h)
146 for (
auto const &p: h)
147 out <<
"<" << p.first <<
": " << p.second <<
"> ";
154 #endif // PXR_BASE_TF_OSTREAM_METHODS_H
This is a small-vector class with local storage optimization, the local storage can be specified via ...