20 template <
typename Ctx>
24 std::istringstream is{name};
27 auto res = Ctx::make(is);
28 require(is.peek() == EOF,
"unexpected trailing characters: ", is);
31 catch (
const std::runtime_error& e)
33 raise(e,
" while reading context: ", name);
42 template <
typename Ctx>
46 return vcsn::make_context<Ctx>(name);
61 template <Automaton Aut>
65 const auto& a = aut->
as<Aut>();
70 template <
typename ExpSet>
74 const auto& e = exp->
as<ExpSet>().valueset();
79 template <
typename ExpansionSet>
83 const auto& e = exp->
as<ExpansionSet>().valueset();
88 template <
typename PolynomialSet>
92 const auto& p = poly->
as<PolynomialSet>().valueset();
108 template <
typename Ctx1,
typename Ctx2>
112 return join(c1->
as<Ctx1>(), c2->
as<Ctx2>());
128 template <
typename Ctx>
132 const auto& c = ctx->
as<Ctx>();
143 template <
typename Ctx>
146 -> std::enable_if_t<Ctx::is_lat, size_t>
151 template <
typename Ctx>
154 -> std::enable_if_t<!Ctx::is_lat, size_t>
164 template <
typename Ctx>
context make_context(const std::string &name)
Bridge.
context context_of(const automaton &aut)
Bridge.
context make_word_context(const context &ctx)
Bridge.
context join(const context &c1, const context &c2)
Bridge.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
auto & as()
Downcast to the exact type.
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
context context_of_expression(const expression &exp)
Bridge (context_of).
context context_of_expansion(const expansion &exp)
Bridge (context_of).
size_t num_tapes(const context &ctx)
Bridge.
context context_of_polynomial(const polynomial &poly)
Bridge (context_of).
Template-less root for contexts.
auto & as()
Extract wrapped typed value.
value_impl< detail::expression_tag > expression
auto & as()
Extract wrapped typed automaton.
constexpr auto num_tapes(const Ctx &) -> std::enable_if_t< Ctx::is_lat, size_t >
Ctx make_context(const std::string &name)
Build a context from its name.