/usr/include/boost/hof
NameSizeModeActions
detail/-0755rm
alias.hpp55520644editdlrm
always.hpp42610644editdlrm
apply.hpp83630644editdlrm
apply_eval.hpp44280644editdlrm
arg.hpp31480644editdlrm
capture.hpp54190644editdlrm
combine.hpp38770644editdlrm
compose.hpp50420644editdlrm
config.hpp61490644editdlrm
construct.hpp87740644editdlrm
decay.hpp17900644editdlrm
decorate.hpp63290644editdlrm
eval.hpp24000644editdlrm
first_of.hpp71000644editdlrm
fix.hpp63140644editdlrm
flip.hpp26900644editdlrm
flow.hpp50600644editdlrm
fold.hpp50000644editdlrm
function.hpp31290644editdlrm
function_param_limit.hpp16580644editdlrm
identity.hpp18840644editdlrm
if.hpp33140644editdlrm
implicit.hpp40410644editdlrm
indirect.hpp32680644editdlrm
infix.hpp60430644editdlrm
is_invocable.hpp17060644editdlrm
is_unpackable.hpp33410644editdlrm
lambda.hpp64580644editdlrm
lazy.hpp87290644editdlrm
lift.hpp37520644editdlrm
limit.hpp38170644editdlrm
match.hpp33310644editdlrm
mutable.hpp19880644editdlrm
pack.hpp127470644editdlrm
partial.hpp83070644editdlrm
pipable.hpp62270644editdlrm
placeholders.hpp137990644editdlrm
proj.hpp75170644editdlrm
protect.hpp21450644editdlrm
repeat.hpp41840644editdlrm
repeat_while.hpp51540644editdlrm
result.hpp36440644editdlrm
returns.hpp86070644editdlrm
reveal.hpp121870644editdlrm
reverse_fold.hpp52710644editdlrm
rotate.hpp25760644editdlrm
static.hpp23950644editdlrm
tap.hpp21180644editdlrm
unpack.hpp55880644editdlrm
unpack_sequence.hpp18100644editdlrm
version.hpp6790644editdlrm
Edit: /usr/include/boost/hof/function.hpp (3129B)
/*============================================================================= Copyright (c) 2014 Paul Fultz II function.h Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #ifndef BOOST_HOF_GUARD_FUNCTION_FUNCTION_H #define BOOST_HOF_GUARD_FUNCTION_FUNCTION_H /// BOOST_HOF_STATIC_FUNCTION /// =================== /// /// Description /// ----------- /// /// The `BOOST_HOF_STATIC_FUNCTION` macro allows initializing a function object from a /// `constexpr` expression. It uses the best practices as outlined in /// [N4381](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html). /// This includes using `const` to avoid global state, compile-time /// initialization of the function object to avoid the [static initialization /// order fiasco](https://isocpp.org/wiki/faq/ctors#static-init-order), and an /// external address of the function object that is the same across translation /// units to avoid possible One-Definition-Rule(ODR) violations. /// /// In C++17, this achieved using the `inline` keyword. However, on older /// compilers it is initialized using a reference to a static member variable. /// The static member variable is default constructed, as such the user variable /// is always default constructed regardless of the expression. /// /// By default, all functions defined with `BOOST_HOF_STATIC_FUNCTION` use the /// [`boost::hof::reveal`](/include/boost/hof/reveal) adaptor to improve error messages. /// /// Example /// ------- /// /// #include /// #include /// /// struct sum_f /// { /// template /// T operator()(T x, U y) const /// { /// return x+y; /// } /// }; /// /// BOOST_HOF_STATIC_FUNCTION(sum) = sum_f(); /// BOOST_HOF_STATIC_FUNCTION(partial_sum) = boost::hof::partial(sum_f()); /// /// int main() { /// assert(sum(1, 2) == partial_sum(1)(2)); /// } /// #include #if !BOOST_HOF_HAS_INLINE_VARIABLES #include #include #endif namespace boost { namespace hof { namespace detail { struct reveal_static_const_factory { constexpr reveal_static_const_factory() {} template constexpr reveal_adaptor operator=(const F& f) const { #if BOOST_HOF_HAS_INLINE_VARIABLES #else static_assert(BOOST_HOF_IS_DEFAULT_CONSTRUCTIBLE(F), "Static functions must be default constructible"); #endif return reveal_adaptor(f); } }; }}} // namespace boost::hof #if BOOST_HOF_HAS_INLINE_VARIABLES #define BOOST_HOF_STATIC_FUNCTION(name) inline const constexpr auto name = boost::hof::detail::reveal_static_const_factory() #else #define BOOST_HOF_STATIC_FUNCTION(name) BOOST_HOF_STATIC_CONST_VAR(name) = BOOST_HOF_DETAIL_MSVC_CONSTEXPR_DEDUCE boost::hof::detail::reveal_static_const_factory() #endif #endif