20 template <
typename ...T>
pass(T...) {}
26 void print_(std::ostream& o,
const T& arg,
long)
34 inline void print_(std::ostream& o, std::istream& is,
long)
38 std::getline(is, buf,
'\n');
46 inline void print_(std::ostream& o, std::istringstream& is,
long)
48 print_(o, static_cast<std::istream&>(is), 0);
53 auto print_(std::ostream& o,
const T& arg,
int)
54 -> decltype(arg.print_set(o),
void())
65 auto print_(std::ostream& o,
const T& e,
int)
66 -> decltype(e.what(),
void())
68 o << e.what() <<
"\n";
73 template <
typename... Args>
75 void raise(Args&&... args)
78 using swallow =
int[];
83 throw std::runtime_error{o.str()};
90 template <
typename Bool,
typename... Args>
94 raise(std::forward<Args>(args)...);
98 template <
typename WeightSet>
101 const typename WeightSet::value_t& w)
103 raise(ws,
": value is not starrable: ",
to_string(ws, w));
111 #define VCSN_REQUIRE(Cond, ...) \
114 ::vcsn::raise(__VA_ARGS__); \
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
ATTRIBUTE_NORETURN void raise_not_starrable(const WeightSet &ws, const typename WeightSet::value_t &w)
This value is not starrable.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
std::string to_string(direction d)
Conversion to string.
Provide a variadic mul on top of a binary mul(), and one().
void print_(std::ostream &o, const T &arg, long)
Serialize arg into o.