[bimap] Simplify initialization
This commit is contained in:
parent
d2c364f6e7
commit
b860b44229
|
@ -33,15 +33,14 @@
|
||||||
/* Bi-directional map */
|
/* Bi-directional map */
|
||||||
struct hb_bimap_t
|
struct hb_bimap_t
|
||||||
{
|
{
|
||||||
hb_bimap_t () { init (); }
|
/* XXX(remove) */
|
||||||
~hb_bimap_t () { fini (); }
|
|
||||||
|
|
||||||
void init ()
|
void init ()
|
||||||
{
|
{
|
||||||
forw_map.init ();
|
forw_map.init ();
|
||||||
back_map.init ();
|
back_map.init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX(remove) */
|
||||||
void fini ()
|
void fini ()
|
||||||
{
|
{
|
||||||
forw_map.fini ();
|
forw_map.fini ();
|
||||||
|
@ -99,14 +98,6 @@ struct hb_bimap_t
|
||||||
/* Inremental bimap: only lhs is given, rhs is incrementally assigned */
|
/* Inremental bimap: only lhs is given, rhs is incrementally assigned */
|
||||||
struct hb_inc_bimap_t : hb_bimap_t
|
struct hb_inc_bimap_t : hb_bimap_t
|
||||||
{
|
{
|
||||||
hb_inc_bimap_t () { init (); }
|
|
||||||
|
|
||||||
void init ()
|
|
||||||
{
|
|
||||||
hb_bimap_t::init ();
|
|
||||||
next_value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add a mapping from lhs to rhs with a unique value if lhs is unknown.
|
/* Add a mapping from lhs to rhs with a unique value if lhs is unknown.
|
||||||
* Return the rhs value as the result.
|
* Return the rhs value as the result.
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +156,7 @@ struct hb_inc_bimap_t : hb_bimap_t
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int next_value;
|
unsigned int next_value = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* HB_BIMAP_HH */
|
#endif /* HB_BIMAP_HH */
|
||||||
|
|
Loading…
Reference in New Issue