From: Marc Fehling Date: Sun, 4 Aug 2019 15:34:14 +0000 (-0600) Subject: Added 'boost/type_traits/detail/is_likely_lambda.hpp'. X-Git-Tag: v9.2.0-rc1~1327^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b389ac4aea5e3006c9b6a0ecb046c068cdcdefa4;p=dealii.git Added '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 +