/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/lambda.hpp (6458B)
/*============================================================================= Copyright (c) 2014 Paul Fultz II lambda.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_LAMBDA_H #define BOOST_HOF_GUARD_FUNCTION_LAMBDA_H /// BOOST_HOF_STATIC_LAMBDA /// ================= /// /// Description /// ----------- /// /// The `BOOST_HOF_STATIC_LAMBDA` macro allows initializing non-capturing lambdas at /// compile-time in a `constexpr` expression. /// /// Example /// ------- /// /// #include /// #include /// /// const constexpr auto add_one = BOOST_HOF_STATIC_LAMBDA(int x) /// { /// return x + 1; /// }; /// /// int main() { /// assert(3 == add_one(2)); /// } /// /// BOOST_HOF_STATIC_LAMBDA_FUNCTION /// ========================== /// /// Description /// ----------- /// /// The `BOOST_HOF_STATIC_LAMBDA_FUNCTION` macro allows initializing a global /// function object that contains non-capturing lambdas. It also ensures that /// the global function object has a unique address across translation units. /// This helps prevent possible ODR-violations. /// /// By default, all functions defined with `BOOST_HOF_STATIC_LAMBDA_FUNCTION` use /// the `boost::hof::reveal` adaptor to improve error messages. /// /// Example /// ------- /// /// #include /// #include /// /// BOOST_HOF_STATIC_LAMBDA_FUNCTION(add_one) = [](int x) /// { /// return x + 1; /// }; /// int main() { /// assert(3 == add_one(2)); /// } /// #include // TODO: Move this to a detail header #if !BOOST_HOF_HAS_CONSTEXPR_LAMBDA || !BOOST_HOF_HAS_INLINE_LAMBDAS #include #include #include #include #include #include #ifndef BOOST_HOF_REWRITE_STATIC_LAMBDA #ifdef _MSC_VER #define BOOST_HOF_REWRITE_STATIC_LAMBDA 1 #else #define BOOST_HOF_REWRITE_STATIC_LAMBDA 0 #endif #endif namespace boost { namespace hof { namespace detail { template struct static_function_wrapper { // Default constructor necessary for MSVC constexpr static_function_wrapper() {} static_assert(BOOST_HOF_IS_EMPTY(F), "Function or lambda expression must be empty"); struct failure : failure_for {}; template const F& base_function(Ts&&...) const { return reinterpret_cast(*this); } BOOST_HOF_RETURNS_CLASS(static_function_wrapper); template BOOST_HOF_SFINAE_RESULT(const F&, id_...) operator()(Ts&&... xs) const BOOST_HOF_SFINAE_RETURNS ( BOOST_HOF_RETURNS_REINTERPRET_CAST(const F&)(*BOOST_HOF_CONST_THIS)(BOOST_HOF_FORWARD(Ts)(xs)...) ); }; struct static_function_wrapper_factor { constexpr static_function_wrapper_factor() {} template constexpr static_function_wrapper operator= (const F&) const { // static_assert(std::is_literal_type>::value, "Function wrapper not a literal type"); return {}; } }; #if BOOST_HOF_REWRITE_STATIC_LAMBDA template struct is_rewritable : std::false_type {}; template struct is_rewritable::type> : std::is_same {}; template struct is_rewritable1 : std::false_type {}; template struct is_rewritable1::type> : std::is_same {}; template struct rewrite_lambda; template class Adaptor, class... Ts> struct rewrite_lambda, typename std::enable_if< is_rewritable>::value >::type> { typedef Adaptor::type...> type; }; template class Adaptor, class T, class... Ts> struct rewrite_lambda, typename std::enable_if< is_rewritable1>::value >::type> { typedef Adaptor::type, Ts...> type; }; template struct rewrite_lambda::value && !is_rewritable::value && !is_rewritable1::value >::type> { typedef static_function_wrapper type; }; template struct rewrite_lambda::value && !is_rewritable::value && !is_rewritable1::value >::type> { typedef T type; }; #endif template struct reveal_static_lambda_function_wrapper_factor { constexpr reveal_static_lambda_function_wrapper_factor() {} #if BOOST_HOF_REWRITE_STATIC_LAMBDA template constexpr reveal_adaptor::type> operator=(const F&) const { return reveal_adaptor::type>(); } #elif BOOST_HOF_HAS_CONST_FOLD template constexpr const reveal_adaptor& operator=(const F&) const { return reinterpret_cast&>(static_const_var()); } #else template constexpr reveal_adaptor> operator=(const F&) const { return {}; } #endif }; }}} // namespace boost::hof #endif #if BOOST_HOF_HAS_CONSTEXPR_LAMBDA #define BOOST_HOF_STATIC_LAMBDA [] #else #define BOOST_HOF_DETAIL_MAKE_STATIC BOOST_HOF_DETAIL_CONSTEXPR_DEDUCE boost::hof::detail::static_function_wrapper_factor() #define BOOST_HOF_STATIC_LAMBDA BOOST_HOF_DETAIL_MAKE_STATIC = [] #endif #if BOOST_HOF_HAS_INLINE_LAMBDAS #define BOOST_HOF_STATIC_LAMBDA_FUNCTION BOOST_HOF_STATIC_FUNCTION #else #define BOOST_HOF_DETAIL_MAKE_REVEAL_STATIC(T) BOOST_HOF_DETAIL_CONSTEXPR_DEDUCE_UNIQUE(T) boost::hof::detail::reveal_static_lambda_function_wrapper_factor() #define BOOST_HOF_STATIC_LAMBDA_FUNCTION(name) \ struct fit_private_static_function_ ## name {}; \ BOOST_HOF_STATIC_AUTO_REF name = BOOST_HOF_DETAIL_MAKE_REVEAL_STATIC(fit_private_static_function_ ## name) #endif #endif