|
|
|||
File indexing completed on 2025-12-13 09:42:30
0001 /* 0002 * Copyright Andrey Semashev 2024. 0003 * Distributed under the Boost Software License, Version 1.0. 0004 * (See accompanying file LICENSE_1_0.txt or copy at 0005 * http://www.boost.org/LICENSE_1_0.txt) 0006 */ 0007 /*! 0008 * \file functor.hpp 0009 * \author Andrey Semashev 0010 * \date 2024-01-23 0011 * 0012 * This header contains a \c functor implementation. This is a function object 0013 * that invokes a function that is specified as its template parameter. 0014 */ 0015 0016 #ifndef BOOST_CORE_FUNCTOR_HPP 0017 #define BOOST_CORE_FUNCTOR_HPP 0018 0019 namespace boost::core { 0020 0021 // Block unintended ADL 0022 namespace functor_ns { 0023 0024 //! A function object that invokes a function specified as its template parameter 0025 template< auto Function > 0026 struct functor 0027 { 0028 template< typename... Args > 0029 auto operator() (Args&&... args) const noexcept(noexcept(Function(static_cast< Args&& >(args)...))) -> decltype(Function(static_cast< Args&& >(args)...)) 0030 { 0031 return Function(static_cast< Args&& >(args)...); 0032 } 0033 }; 0034 0035 } // namespace functor_ns 0036 0037 using functor_ns::functor; 0038 0039 } // namespace boost::core 0040 0041 #endif // BOOST_CORE_FUNCTOR_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|