From b389ac4aea5e3006c9b6a0ecb046c068cdcdefa4 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Sun, 4 Aug 2019 09:34:14 -0600 Subject: [PATCH] Added 'boost/type_traits/detail/is_likely_lambda.hpp'. --- .../type_traits/detail/is_likely_lambda.hpp | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 bundled/boost-1.70.0/include/boost/type_traits/detail/is_likely_lambda.hpp diff --git a/bundled/boost-1.70.0/include/boost/type_traits/detail/is_likely_lambda.hpp b/bundled/boost-1.70.0/include/boost/type_traits/detail/is_likely_lambda.hpp new file mode 100644 index 0000000000..21810dda40 --- /dev/null +++ b/bundled/boost-1.70.0/include/boost/type_traits/detail/is_likely_lambda.hpp @@ -0,0 +1,95 @@ +/* Copyright 2017 Joaquin M Lopez Munoz. + * 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) + * + * See http://www.boost.org/libs/poly_collection for library home page. + */ + +#ifndef BOOST_TT_DETAIL_IS_LIKELY_STATELESS_LAMBDA_HPP +#define BOOST_TT_DETAIL_IS_LIKELY_STATELESS_LAMBDA_HPP + +#if defined(_MSC_VER) +#pragma once +#endif + +#include +#include + +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) +// +// We don't need or use this, just define a dummy class: +// +namespace boost{ namespace type_traits_detail{ + +template +struct is_likely_stateless_lambda : public false_type {}; + +}} + +#elif !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !BOOST_WORKAROUND(BOOST_MSVC, < 1900)\ + && !(BOOST_WORKAROUND(BOOST_MSVC, == 1900) && defined(__CLR_VER)) + +#include +#include + +namespace boost{ + +namespace type_traits_detail{ + +/* Stateless lambda expressions have one (and only one) call operator and are + * convertible to a function pointer with the same signature. Non-lambda types + * could satisfy this too, hence the "likely" qualifier. + */ + +template +struct has_one_operator_call_helper +{ + template static boost::true_type test(decltype(&Q::operator())*); + template static boost::false_type test(...); + + using type=decltype(test(nullptr)); +}; + +template +using has_one_operator_call=typename has_one_operator_call_helper::type; + +template +struct equivalent_function_pointer +{ + template + static auto helper(R (Q::*)(Args...)const)->R(*)(Args...); + template + static auto helper(R (Q::*)(Args...))->R(*)(Args...); + + using type=decltype(helper(&T::operator())); +}; + +template +struct is_likely_stateless_lambda : false_type{}; + +template +struct is_likely_stateless_lambda< + T, + typename boost::enable_if_::value>::type> : + boost::is_convertible::type +>{}; + +} /* namespace type_traits_detail */ + +} /* namespace boost */ + +#else + // + // Can't implement this: + // +namespace boost { + namespace type_traits_detail { + + template + struct is_likely_stateless_lambda : public boost::integral_constant {}; +}} + +#endif +#endif + -- 2.39.5