diff options
author | James Ward <james.ward@arm.com> | 2020-09-25 11:43:21 +0100 |
---|---|---|
committer | James Ward <james.ward@arm.com> | 2020-09-30 08:41:31 +0000 |
commit | 22a4e1539aca7d39d7abc932f0a4d0b27beedf80 (patch) | |
tree | 95152943571413af5a3b550ac391bb17f258feef /third-party/mapbox/variant_io.hpp | |
parent | ba3ef18cb6117c49fcdbf177dce5991d6d679cbc (diff) | |
download | armnn-22a4e1539aca7d39d7abc932f0a4d0b27beedf80.tar.gz |
IVGCVSW-4519 Remove Boost Variant and apply_visitor variant
* add mapbox/variant third party package
Signed-off-by: James Ward <james.ward@arm.com>
Change-Id: I181302780edd9dace40f158a11327316a12ce69a
Diffstat (limited to 'third-party/mapbox/variant_io.hpp')
-rw-r--r-- | third-party/mapbox/variant_io.hpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/third-party/mapbox/variant_io.hpp b/third-party/mapbox/variant_io.hpp new file mode 100644 index 0000000000..1456cc5abc --- /dev/null +++ b/third-party/mapbox/variant_io.hpp @@ -0,0 +1,45 @@ +#ifndef MAPBOX_UTIL_VARIANT_IO_HPP +#define MAPBOX_UTIL_VARIANT_IO_HPP + +#include <iosfwd> + +#include <mapbox/variant.hpp> + +namespace mapbox { +namespace util { + +namespace detail { +// operator<< helper +template <typename Out> +class printer +{ +public: + explicit printer(Out& out) + : out_(out) {} + printer& operator=(printer const&) = delete; + + // visitor + template <typename T> + void operator()(T const& operand) const + { + out_ << operand; + } + +private: + Out& out_; +}; +} + +// operator<< +template <typename CharT, typename Traits, typename... Types> +VARIANT_INLINE std::basic_ostream<CharT, Traits>& +operator<<(std::basic_ostream<CharT, Traits>& out, variant<Types...> const& rhs) +{ + detail::printer<std::basic_ostream<CharT, Traits>> visitor(out); + apply_visitor(visitor, rhs); + return out; +} +} // namespace util +} // namespace mapbox + +#endif // MAPBOX_UTIL_VARIANT_IO_HPP |