/
usr
/
include
/
boost
/
hana
/
detail
/
/usr/include/boost/hana/detail
mkdir
upload
Name
Size
Mode
Actions
operators/
-
0755
rm
variadic/
-
0755
rm
algorithm.hpp
5973
0644
edit
dl
rm
any_of.hpp
1380
0644
edit
dl
rm
array.hpp
3374
0644
edit
dl
rm
canonical_constant.hpp
2700
0644
edit
dl
rm
concepts.hpp
3019
0644
edit
dl
rm
create.hpp
935
0644
edit
dl
rm
decay.hpp
1715
0644
edit
dl
rm
dispatch_if.hpp
2082
0644
edit
dl
rm
ebo.hpp
3874
0644
edit
dl
rm
fast_and.hpp
600
0644
edit
dl
rm
first_unsatisfied_index.hpp
1731
0644
edit
dl
rm
hash_table.hpp
5487
0644
edit
dl
rm
has_common_embedding.hpp
2473
0644
edit
dl
rm
has_duplicates.hpp
2337
0644
edit
dl
rm
index_if.hpp
1610
0644
edit
dl
rm
integral_constant.hpp
10052
0644
edit
dl
rm
intrinsics.hpp
1984
0644
edit
dl
rm
nested_by.hpp
1255
0644
edit
dl
rm
nested_by_fwd.hpp
1990
0644
edit
dl
rm
nested_than.hpp
854
0644
edit
dl
rm
nested_than_fwd.hpp
1624
0644
edit
dl
rm
nested_to.hpp
788
0644
edit
dl
rm
nested_to_fwd.hpp
1627
0644
edit
dl
rm
preprocessor.hpp
1435
0644
edit
dl
rm
std_common_type.hpp
1085
0644
edit
dl
rm
struct_macros.hpp
798577
0644
edit
dl
rm
type_at.hpp
1594
0644
edit
dl
rm
type_foldl1.hpp
3916
0644
edit
dl
rm
type_foldr1.hpp
3903
0644
edit
dl
rm
unpack_flatten.hpp
2416
0644
edit
dl
rm
void_t.hpp
518
0644
edit
dl
rm
wrong.hpp
861
0644
edit
dl
rm
Edit:
/usr/include/boost/hana/detail/ebo.hpp
(3874B)
/*! @file Defines `boost::hana::detail::ebo`. @copyright Louis Dionne 2013-2016 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #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 { ////////////////////////////////////////////////////////////////////////// // ebo<K, V> // // Building block to implement the Empty Base Optimization (EBO). We // use a short name and define it in a short namespace to reduce // symbol lengths, since this type is used as a building block for // other widely used types such as `hana::pair`. // // When available, we use compiler intrinsics to reduce the number // of instantiations. // // `ebo` provides a limited set of constructors to reduce instantiations. // Also, the constructors are open-ended and they do not check for the // validity of their arguments, again to reduce compile-time costs. // Users of `ebo` should make sure that they only try to construct an // `ebo` from a compatible value. // // EBOs can be indexed using an arbitrary type. The recommended usage is // to define an integrap constant wrapper for the specific container using // EBO, and then index using that wrapper: // // template <int> struct idx; // wrapper for tuple // template <typename ...T> // struct tuple : ebo<idx<0>, T0>, ebo<idx<1>, T1>, ... { }; // // The reason for defining one wrapper per container is to avoid any issues // that can arise when using `ebo_get`, which casts to the base class. If // `tuple` and `pair` are inheritting from `ebo`s with the same indexing // scheme, trying to use `ebo_get` on a tuple of pairs will trigger an // ambiguous base class conversion, since both tuple and pair inherit // from `ebo`s with the same keys. ////////////////////////////////////////////////////////////////////////// template <typename K, typename V, bool = BOOST_HANA_TT_IS_EMPTY(V) && !BOOST_HANA_TT_IS_FINAL(V) > struct ebo; // Specialize storage for empty types 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)) { } }; // Specialize storage for non-empty types 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_; }; ////////////////////////////////////////////////////////////////////////// // ebo_get ////////////////////////////////////////////////////////////////////////// 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_); } } // end namespace _hana BOOST_HANA_NAMESPACE_BEGIN namespace detail { using ::_hana::ebo; using ::_hana::ebo_get; } BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_DETAIL_EBO_HPP
Save
cmd:
run