types/tagged: add const accessor
This commit is contained in:
parent
8c42829f4f
commit
d124fffcb3
@ -92,11 +92,20 @@ namespace cruft {
|
|||||||
InnerT&
|
InnerT&
|
||||||
get (void)&
|
get (void)&
|
||||||
{
|
{
|
||||||
CHECK_EQ (InnerT::tag, m_tag);
|
CHECK (InnerT::tag == m_tag);
|
||||||
return *cruft::cast::alignment<InnerT*> (m_data + 0);
|
return *cruft::cast::alignment<InnerT*> (m_data + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename InnerT>
|
||||||
|
InnerT const&
|
||||||
|
get (void) const&
|
||||||
|
{
|
||||||
|
CHECK (InnerT::tag == m_tag);
|
||||||
|
return *cruft::cast::alignment<InnerT const*> (m_data + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Set the inner member to a supplied value and store the associated
|
/// Set the inner member to a supplied value and store the associated
|
||||||
/// type code.
|
/// type code.
|
||||||
template <typename InnerT>
|
template <typename InnerT>
|
||||||
|
Loading…
Reference in New Issue
Block a user