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);
StateNameset state_nameset_t
boost::bimaps::set_of< state_t > right_t
Storage for state index.
typename stateset_t::value_t state_t
typename state_nameset_t::value_t state_name_t
auto find_key(const state_name_t &sn) const
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
typename stateset_t::value_t state_t
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
const origins_t & origins() const
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.
static state_t state(const const_iterator &i)
Get the state from a const_iterator.
typename bimap_t::const_iterator const_iterator
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::unordered_map< state_name_t, state_t, vcsn::hash< state_nameset_t >, vcsn::equal_to< state_nameset_t >> map_t
const origins_t & origins() const
static const state_name_t & state_name(const const_iterator &i)
Get the state name from a const_iterator.
auto emplace(Args &&...args)
Insert a new state.
typename bimap_t::right_map origins_t
A map from state indexes to state names.
std::map< state_t, state_name_t > origins_t
A map from state indexes to state names.
boost::bimap< left_t, right_t > bimap_t
Bidirectional map state_name_t -> state_t;.
auto find_key(const state_name_t &s) const
static const state_name_t & state_name(const const_iterator &i)
Get the state name from a const_iterator.
Request the unordered_map implementation.
static state_t state(const const_iterator &i)
Get the state from a const_iterator.
StateNameset state_nameset_t