File indexing completed on 2025-09-17 08:45:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_POLY_COLLECTION_DETAIL_COPYABLE_HPP
0010 #define BOOST_POLY_COLLECTION_DETAIL_COPYABLE_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <functional>
0017 #include <type_traits>
0018
0019 namespace boost{
0020
0021 namespace poly_collection{
0022
0023 namespace detail{
0024
0025
0026
0027 template<typename T,typename=void>
0028 struct copyable_impl{using type=T;};
0029
0030 template<typename T>
0031 struct reference_wrapper
0032 {
0033 reference_wrapper(T& x):p{&x}{}
0034
0035 operator T&()const noexcept{return *p;}
0036
0037 T* p;
0038 };
0039
0040 template<typename T>
0041 struct copyable_impl<
0042 T,
0043 typename std::enable_if<!std::is_copy_constructible<T>::value>::type
0044 >
0045 {using type=reference_wrapper<const T>;};
0046
0047 template<typename T>
0048 using copyable=typename copyable_impl<T>::type;
0049
0050 template<typename T>
0051 copyable<T> make_copyable(const T& x){return x;}
0052
0053 }
0054
0055 }
0056
0057 }
0058
0059 #endif