Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:54:08

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Eric Niebler 2013-present
0005 //
0006 //  Use, modification and distribution is subject to the
0007 //  Boost Software License, Version 1.0. (See accompanying
0008 //  file LICENSE_1_0.txt or copy at
0009 //  http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // Project home: https://github.com/ericniebler/range-v3
0012 //
0013 
0014 #ifndef RANGES_V3_UTILITY_COPY_HPP
0015 #define RANGES_V3_UTILITY_COPY_HPP
0016 
0017 #include <concepts/concepts.hpp>
0018 
0019 #include <range/v3/range_fwd.hpp>
0020 
0021 #include <range/v3/utility/static_const.hpp>
0022 
0023 #include <range/v3/detail/prologue.hpp>
0024 
0025 namespace ranges
0026 {
0027     /// \addtogroup group-utility
0028     /// @{
0029     namespace aux
0030     {
0031         struct copy_fn : copy_tag
0032         {
0033             template(typename T)(
0034                 requires constructible_from<detail::decay_t<T>, T>)
0035             constexpr auto operator()(T && t) const -> detail::decay_t<T>
0036             {
0037                 return static_cast<T &&>(t);
0038             }
0039 
0040             /// \ingroup group-utility
0041             /// \sa `copy_fn`
0042             template<typename T>
0043             friend constexpr auto operator|(T && t, copy_fn)
0044                 -> CPP_broken_friend_ret(detail::decay_t<T>)(
0045                     requires constructible_from<detail::decay_t<T>, T>)
0046             {
0047                 return static_cast<T &&>(t);
0048             }
0049         };
0050 
0051         /// \ingroup group-utility
0052         /// \sa `copy_fn`
0053         RANGES_INLINE_VARIABLE(copy_fn, copy)
0054     } // namespace aux
0055     /// @}
0056 } // namespace ranges
0057 
0058 #include <range/v3/detail/epilogue.hpp>
0059 
0060 #endif