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)
37 auto buf = std::string{};
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())
61 auto print_(std::ostream& o,
const T& e,
int)
62 -> decltype(e.what(),
void())
64 o << e.what() <<
'\n';
69 template <
typename... Args>
71 void raise(Args&&... args)
74 using swallow =
int[];
79 throw std::runtime_error{o.str()};
86 template <
typename Bool,
typename... Args>
90 raise(std::forward<Args>(args)...);
98 #define VCSN_REQUIRE(Cond, ...) \ 101 ::vcsn::raise(__VA_ARGS__); \
Provide a variadic mul on top of a binary mul(), and one().
std::string str_quote(Args &&... args)
Convert to a string, in quotes.
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.
void print_(std::ostream &o, const T &arg, long)
Serialize arg into o.