summaryrefslogtreecommitdiff
path: root/src/bindings/cxx/eina_cxx/eina_variant.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/cxx/eina_cxx/eina_variant.hh')
-rw-r--r--src/bindings/cxx/eina_cxx/eina_variant.hh16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bindings/cxx/eina_cxx/eina_variant.hh b/src/bindings/cxx/eina_cxx/eina_variant.hh
index 358688a..4885c80 100644
--- a/src/bindings/cxx/eina_cxx/eina_variant.hh
+++ b/src/bindings/cxx/eina_cxx/eina_variant.hh
@@ -6,6 +6,7 @@
6#include <utility> 6#include <utility>
7#include <type_traits> 7#include <type_traits>
8#include <tuple> 8#include <tuple>
9#include <iosfwd>
9 10
10#include <eina_aligned_union.hh> 11#include <eina_aligned_union.hh>
11 12
@@ -149,6 +150,17 @@ struct destroy_visitor
149 } 150 }
150}; 151};
151 152
153struct ostream_visitor
154{
155 std::ostream* s;
156 typedef std::ostream& result_type;
157 template <typename T>
158 std::ostream& operator()(T const& other) const
159 {
160 return *s << other;
161 }
162};
163
152template <typename T> 164template <typename T>
153struct get_visitor 165struct get_visitor
154{ 166{
@@ -295,6 +307,10 @@ private:
295 && (rhs.type == -1 307 && (rhs.type == -1
296 || rhs.visit(compare_equal_visitor{&lhs.buffer})); 308 || rhs.visit(compare_equal_visitor{&lhs.buffer}));
297 } 309 }
310 friend std::ostream& operator<<(std::ostream& s, variant<Args...> const& rhs)
311 {
312 return rhs.visit(ostream_visitor{&s});
313 }
298 314
299 int type; 315 int type;
300 /** 316 /**