Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:47:26

0001 /*
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * https://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * Copyright (c) 2025 Andrey Semashev
0007  */
0008 
0009 #ifndef BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
0010 #define BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
0011 
0012 #include <boost/core/use_default.hpp>
0013 
0014 namespace boost {
0015 namespace iterators {
0016 namespace detail {
0017 
0018 // If T is use_default, return Default, otherwise - Nondefault.
0019 // By default, Nondefault is T, which means
0020 // the metafunction can be called with just two parameters
0021 // and in that case will return either T or Default.
0022 template< typename T, typename Default, typename Nondefault = T >
0023 struct if_default
0024 {
0025     using type = Nondefault;
0026 };
0027 
0028 template< typename Default, typename Nondefault >
0029 struct if_default< use_default, Default, Nondefault >
0030 {
0031     using type = Default;
0032 };
0033 
0034 template< typename T, typename Default, typename Nondefault = T >
0035 using if_default_t = typename if_default< T, Default, Nondefault >::type;
0036 
0037 } // namespace detail
0038 } // namespace iterators
0039 } // namespace boost
0040 
0041 #endif // BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_