1#ifndef XPED_ENUM_STREAM_HPP_
2#define XPED_ENUM_STREAM_HPP_
4#include <boost/describe.hpp>
8template <typename T, typename = typename std::enable_if_t<boost::describe::has_describe_enumerators<T>::value>>
9std::ostream&
operator<<(std::ostream& os,
const T& t)
11 os << boost::describe::enum_to_string(t,
"Unknown");
15template <typename T, typename = typename std::enable_if_t<boost::describe::has_describe_enumerators<T>::value>>
20 bool success = boost::describe::enum_from_string(tmp.c_str(), t);
21 if(not success) {
throw std::runtime_error(std::string(
"Invalid enumerator name '") + tmp +
"'"); }
27template <typename T, typename = typename std::enable_if_t<boost::describe::has_describe_enumerators<T>::value>>
30 os << boost::describe::enum_to_string(t,
"Unknown");
34template <typename T, typename = typename std::enable_if_t<boost::describe::has_describe_enumerators<T>::value>>
39 bool success = boost::describe::enum_from_string(tmp.c_str(), t);
40 if(not success) {
throw std::runtime_error(std::string(
"Invalid enumerator name '") + tmp +
"'"); }
std::ostream & operator<<(std::ostream &os, const T &t)
Definition: EnumStream.hpp:28
std::istream & operator>>(std::istream &is, T &t)
Definition: EnumStream.hpp:35
std::ostream & operator<<(std::ostream &os, const FusionTree< depth, Symmetry > &tree)
Definition: FusionTree.hpp:93
std::istream & operator>>(std::istream &is, T &t)
Definition: EnumStream.hpp:16