19 template <
typename Ctx>
23 std::istringstream is{name};
26 auto res = Ctx::make(is);
27 require(is.peek() == EOF,
"unexpected trailing characters: ", is);
30 catch (
const std::runtime_error& e)
32 raise(e,
" while reading context: ",
str_quote(name));
41 template <
typename Ctx>
45 return vcsn::make_context<Ctx>(name);
60 template <Automaton Aut>
64 const auto& a = aut->
as<Aut>();
69 template <
typename ExpSet>
73 const auto& e = exp->
as<ExpSet>().valueset();
78 template <
typename ExpansionSet>
82 const auto& e = exp->
as<ExpansionSet>().valueset();
87 template <
typename PolynomialSet>
91 const auto& p = poly->
as<PolynomialSet>().valueset();
107 template <
typename Ctx1,
typename Ctx2>
111 return join(c1->
as<Ctx1>(), c2->
as<Ctx2>());
127 template <
typename Ctx>
131 const auto& c = ctx->
as<Ctx>();
context make_context(const std::string &name)
Bridge.
context make_word_context(const context &ctx)
Bridge.
auto & as()
Extract wrapped typed value.
context join(const context &c1, const context &c2)
Bridge.
Ctx make_context(const std::string &name)
Build a context from its name.
context context_of_expression(const expression &exp)
Bridge (context_of).
Template-less root for contexts.
context context_of_polynomial(const polynomial &poly)
Bridge (context_of).
auto & as()
Downcast to the exact type.
context context_of(const automaton &aut)
Bridge.
auto & as()
Extract wrapped typed automaton.
value_impl< detail::expression_tag > expression
std::string str_quote(Args &&... args)
Convert to a string, in quotes.
context context_of_expansion(const expansion &exp)
Bridge (context_of).
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.