Skip to content

Commit

Permalink
simplify some code related to variant::storage
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Aug 13, 2016
1 parent 288f40f commit ddba921
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions include/strict_variant/variant_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,20 @@ struct storage {

/***
* Typed access which pierces recursive_wrapper if detail::false_ is passed
* "Internal" (non-piercing) access is achieved if detail::true_ is passed
*/
template <size_t index, typename Internal>
value_t<index> & get_value(const Internal &) & {
template <size_t index>
value_t<index> & get_value(const detail::true_ &) & {
return *reinterpret_cast<value_t<index> *>(this->address());
}

template <size_t index, typename Internal>
const value_t<index> & get_value(const Internal &) const & {
template <size_t index>
const value_t<index> & get_value(const detail::true_ &) const & {
return *reinterpret_cast<const value_t<index> *>(this->address());
}

template <size_t index, typename Internal>
value_t<index> && get_value(const Internal &) && {
template <size_t index>
value_t<index> && get_value(const detail::true_ &) && {
return std::move(*reinterpret_cast<value_t<index> *>(this->address()));
}

Expand Down

0 comments on commit ddba921

Please sign in to comment.