33 template <
typename Tag>
40 template <
typename ValueSet>
41 value_impl(
const ValueSet& vs,
const typename ValueSet::value_t&
v)
42 : self_{std::make_shared<model<ValueSet>>(vs,
v)}
48 return self_->vname();
52 template <
typename ValueSet>
59 template <
typename ValueSet>
60 const auto&
as()
const
88 self_ = std::move(l.
self_);
96 virtual ~
base() =
default;
101 template <
typename ValueSet>
107 : valueset_(
std::move(vs))
108 , value_(
std::move(v))
113 return valueset().sname();
134 std::shared_ptr<base> self_ =
nullptr;
139 template <
typename ValueSetLhs,
typename ValueSetRhs,
typename Tag>
143 const auto& l = lhs->template as<ValueSetLhs>();
144 const auto&
r = rhs->template as<ValueSetRhs>();
145 auto rs =
join(l.valueset(), r.valueset());
146 auto lr = rs.conv(l.valueset(), l.value());
147 auto rr = rs.conv(r.valueset(), r.value());
148 return std::make_tuple(rs, lr, rr);
152 using expansion = value_impl<detail::expansion_tag>;
154 using expression = value_impl<detail::expression_tag>;
156 using label = value_impl<detail::label_tag>;
158 using polynomial = value_impl<detail::polynomial_tag>;
160 using weight = value_impl<detail::weight_tag>;
value_impl< detail::weight_tag > weight
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
model(valueset_t vs, value_t v)
const valueset_t & valueset() const
typename valueset_t::value_t value_t
const value_t value() const
symbol vname() const
A description of the value type.
auto & operator=(const value_impl &l)
value_impl< detail::label_tag > label
value_impl()
Default construction: empty.
const valueset_t valueset_
The value set.
Tag for polynomial/polynomialset.
value_impl< detail::polynomial_tag > polynomial
const value_impl * operator->() const
value_impl< detail::expansion_tag > expansion
const auto & as() const
Extract wrapped typed value.
Tag for expression/expressionset.
std::shared_ptr< base > self_
The wrapped value/valueset.
symbol vname() const override
To dyn_cast(From &&from)
A dynamic_cast in debug mode, static_cast with NDEBUG.
auto & as()
Extract wrapped typed value.
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
auto & operator=(std::nullptr_t)
Abstract wrapped typed Value/ValueSet.
Provide a variadic mul on top of a binary mul(), and one().
const value_t value_
The value.
value_impl * operator->()
value_impl< detail::expression_tag > expression
A wrapped typed Value/ValueSet.
Tag for weight/weightset.
value_impl(const ValueSet &vs, const typename ValueSet::value_t &v)
Tag for expansion/expansionset.