Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:10:40

0001 #ifndef BOOST_POINTEE_DWA200415_HPP
0002 #define BOOST_POINTEE_DWA200415_HPP
0003 
0004 //
0005 // Copyright David Abrahams 2004. Use, modification and distribution is
0006 // subject to the Boost Software License, Version 1.0. (See accompanying
0007 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // typename pointee<P>::type provides the pointee type of P.
0010 //
0011 // For example, it is T for T* and X for shared_ptr<X>.
0012 //
0013 // http://www.boost.org/libs/iterator/doc/pointee.html
0014 //
0015 
0016 #include <iterator>
0017 #include <type_traits>
0018 
0019 #include <boost/detail/is_incrementable.hpp>
0020 
0021 namespace boost {
0022 namespace detail {
0023 
0024 template< typename P >
0025 struct smart_ptr_pointee
0026 {
0027     using type = typename P::element_type;
0028 };
0029 
0030 template<
0031     typename Iterator,
0032     typename = typename std::remove_reference< decltype(*std::declval< Iterator& >()) >::type
0033 >
0034 struct iterator_pointee
0035 {
0036     using type = typename std::iterator_traits< Iterator >::value_type;
0037 };
0038 
0039 template< typename Iterator, typename Reference >
0040 struct iterator_pointee< Iterator, const Reference >
0041 {
0042     using type = typename std::add_const< typename std::iterator_traits< Iterator >::value_type >::type;
0043 };
0044 
0045 } // namespace detail
0046 
0047 template< typename P >
0048 struct pointee :
0049     public std::conditional<
0050         detail::is_incrementable< P >::value,
0051         detail::iterator_pointee< P >,
0052         detail::smart_ptr_pointee< P >
0053     >::type
0054 {
0055 };
0056 
0057 template< typename P >
0058 using pointee_t = typename pointee< P >::type;
0059 
0060 } // namespace boost
0061 
0062 #endif // BOOST_POINTEE_DWA200415_HPP