Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:53

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Andrey Diduh 2019
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_VIEW_ADDRESSOF_HPP
0015 #define RANGES_V3_VIEW_ADDRESSOF_HPP
0016 
0017 #include <type_traits>
0018 #include <utility>
0019 
0020 #include <meta/meta.hpp>
0021 
0022 #include <range/v3/utility/addressof.hpp>
0023 #include <range/v3/view/transform.hpp>
0024 #include <range/v3/view/view.hpp>
0025 
0026 #include <range/v3/detail/prologue.hpp>
0027 
0028 namespace ranges
0029 {
0030     /// \addtogroup group-views
0031     /// @{
0032     namespace views
0033     {
0034         struct addressof_fn
0035         {
0036         private:
0037             struct take_address
0038             {
0039                 template<typename V>
0040                 constexpr V * operator()(V & value) const noexcept
0041                 {
0042                     return detail::addressof(value);
0043                 }
0044             };
0045 
0046         public:
0047             template(typename Rng)(
0048                 requires viewable_range<Rng> AND input_range<Rng> AND
0049                     std::is_lvalue_reference<range_reference_t<Rng>>::value) //
0050             constexpr auto CPP_auto_fun(operator())(Rng && rng)(const) //
0051             (
0052                 return transform(all(static_cast<Rng &&>(rng)), take_address{}) //
0053             )
0054         };
0055 
0056         /// \relates addressof_fn
0057         /// \ingroup group-views
0058         RANGES_INLINE_VARIABLE(view_closure<addressof_fn>, addressof)
0059     } // namespace views
0060     /// @}
0061 } // namespace ranges
0062 
0063 #include <range/v3/detail/epilogue.hpp>
0064 
0065 #endif // RANGES_V3_VIEW_ADDRESSOF_HPP