3 #include <boost/bimap.hpp>
4 #include <boost/bimap/set_of.hpp>
5 #include <boost/bimap/unordered_set_of.hpp>
21 template <
typename StateNameset,
typename Stateset,
31 template <
typename StateNameset,
typename Stateset>
39 using state_t =
typename stateset_t::value_t;
47 using right_t = boost::bimaps::set_of<state_t>;
49 using bimap_t = boost::bimap<left_t, right_t>;
56 template <
typename... Args>
59 return map_.insert({ std::forward<Args>(args)... });
64 return map_.left.find(s);
69 return map_.left.end();
102 template <
typename StateNameset,
typename Stateset>
107 using state_name_t =
typename state_nameset_t::value_t;
113 vcsn::hash<state_nameset_t>,
121 template <
typename... Args>
124 return map_.emplace(std::forward<Args>(args)...);
129 return map_.find(sn);
154 if (origins_.empty())
155 for (
const auto& p: map_)
156 origins_.emplace(p.second, p.first);
typename stateset_t::value_t state_t
const origins_t & origins() const
auto find_key(const state_name_t &s) const
static state_t state(const const_iterator &i)
Get the state from a const_iterator.
auto find_key(const state_name_t &sn) const
const origins_t & origins() const
Request the unordered_map implementation.
auto emplace(Args &&...args)
Insert a new state.
std::unordered_map< state_name_t, state_t, vcsn::hash< state_nameset_t >, vcsn::equal_to< state_nameset_t >> map_t
typename bimap_t::const_iterator const_iterator
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
boost::bimaps::unordered_set_of< state_name_t, vcsn::hash< state_nameset_t >, vcsn::equal_to< state_nameset_t >> left_t
Storage for state names.
typename map_t::const_iterator const_iterator
A bidirectional map from state names to state numbers.
auto emplace(Args &&...args)
Insert a new state.
std::map< state_t, state_name_t > origins_t
A map from state indexes to state names.
StateNameset state_nameset_t
StateNameset state_nameset_t
typename state_nameset_t::value_t state_name_t
static const state_name_t & state_name(const const_iterator &i)
Get the state name from a const_iterator.
boost::bimap< left_t, right_t > bimap_t
Bidirectional map state_name_t -> state_t;.
boost::bimaps::set_of< state_t > right_t
Storage for state index.
typename stateset_t::value_t state_t
typename bimap_t::right_map origins_t
A map from state indexes to state names.
static const state_name_t & state_name(const const_iterator &i)
Get the state name from a const_iterator.
static state_t state(const const_iterator &i)
Get the state from a const_iterator.
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...