123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #ifndef BOOST_HANA_DETAIL_EBO_HPP
- #define BOOST_HANA_DETAIL_EBO_HPP
- #include <boost/hana/config.hpp>
- #include <boost/hana/detail/intrinsics.hpp>
- namespace _hana {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template <typename K, typename V, bool =
- BOOST_HANA_TT_IS_EMPTY(V) && !BOOST_HANA_TT_IS_FINAL(V)
- >
- struct ebo;
-
- template <typename K, typename V>
- struct ebo<K, V, true> : V {
- constexpr ebo() { }
- template <typename T>
- explicit constexpr ebo(T&& t)
- : V(static_cast<T&&>(t))
- { }
- };
-
- template <typename K, typename V>
- struct ebo<K, V, false> {
- constexpr ebo() : data_() { }
- template <typename T>
- explicit constexpr ebo(T&& t)
- : data_(static_cast<T&&>(t))
- { }
- V data_;
- };
-
-
-
- template <typename K, typename V>
- constexpr V const& ebo_get(ebo<K, V, true> const& x)
- { return x; }
- template <typename K, typename V>
- constexpr V& ebo_get(ebo<K, V, true>& x)
- { return x; }
- template <typename K, typename V>
- constexpr V&& ebo_get(ebo<K, V, true>&& x)
- { return static_cast<V&&>(x); }
- template <typename K, typename V>
- constexpr V const& ebo_get(ebo<K, V, false> const& x)
- { return x.data_; }
- template <typename K, typename V>
- constexpr V& ebo_get(ebo<K, V, false>& x)
- { return x.data_; }
- template <typename K, typename V>
- constexpr V&& ebo_get(ebo<K, V, false>&& x)
- { return static_cast<V&&>(x.data_); }
- }
- BOOST_HANA_NAMESPACE_BEGIN
- namespace detail {
- using ::_hana::ebo;
- using ::_hana::ebo_get;
- }
- BOOST_HANA_NAMESPACE_END
- #endif
|