diff --git a/include/boost/indirect_reference.hpp b/include/boost/indirect_reference.hpp index 21f0904..9a8b73f 100644 --- a/include/boost/indirect_reference.hpp +++ b/include/boost/indirect_reference.hpp @@ -1,5 +1,5 @@ #ifndef INDIRECT_REFERENCE_DWA200415_HPP -# define INDIRECT_REFERENCE_DWA200415_HPP +#define INDIRECT_REFERENCE_DWA200415_HPP // // Copyright David Abrahams 2004. Use, modification and distribution is @@ -11,29 +11,30 @@ // http://www.boost.org/libs/iterator/doc/pointee.html // -# include -# include -# include -# include +#include +#include +#include + +#include namespace boost { +namespace detail { -namespace detail +template< typename P > +struct smart_ptr_reference { - template - struct smart_ptr_reference - { - typedef typename boost::pointee

::type& type; - }; -} + using type = typename boost::pointee

::type&; +}; -template -struct indirect_reference - : mpl::eval_if< - detail::is_incrementable

- , iterator_reference

- , detail::smart_ptr_reference

- > +} // namespace detail + +template< typename P > +struct indirect_reference : + std::conditional< + detail::is_incrementable

::value, + iterator_reference

, + detail::smart_ptr_reference

+ >::type { }; diff --git a/include/boost/pointee.hpp b/include/boost/pointee.hpp index 7c209e7..b80aceb 100644 --- a/include/boost/pointee.hpp +++ b/include/boost/pointee.hpp @@ -1,5 +1,5 @@ #ifndef POINTEE_DWA200415_HPP -# define POINTEE_DWA200415_HPP +#define POINTEE_DWA200415_HPP // // Copyright David Abrahams 2004. Use, modification and distribution is @@ -13,45 +13,42 @@ // http://www.boost.org/libs/iterator/doc/pointee.html // -# include -# include -# include +#include +#include #include #include namespace boost { +namespace detail { -namespace detail +template< typename P > +struct smart_ptr_pointee { - template - struct smart_ptr_pointee - { - typedef typename P::element_type type; - }; + using type = typename P::element_type; +}; - template - struct iterator_pointee - { - typedef typename std::iterator_traits::value_type value_type; +template< typename Iterator, typename = typename std::remove_reference())>::type > +struct iterator_pointee +{ + using type = typename std::iterator_traits::value_type; +}; - typedef typename std::conditional< - std::is_const< - typename std::remove_reference())>::type - >::value - , typename std::add_const::type - , value_type - >::type type; - }; -} +template< typename Iterator, typename Reference > +struct iterator_pointee< Iterator, const Reference > +{ + using type = typename std::add_const::value_type>::type; +}; -template -struct pointee - : mpl::eval_if< - detail::is_incrementable

- , detail::iterator_pointee

- , detail::smart_ptr_pointee

- > +} // namespace detail + +template< typename P > +struct pointee : + public std::conditional< + detail::is_incrementable

::value, + detail::iterator_pointee

, + detail::smart_ptr_pointee

+ >::type { };