/
Ant010ff
/
ffpp
Обзор
Документация
Войти
/
Ant010ff
/
ffpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
include/function.hpp
71 строка
2 KB
Ant010ff
Version 2.11.3.
08 авг 2026, 16:44
08 авг 2026, 16:44
fd187d3
Код
Авторство
О чём код?
/* This header is part of a Functional Flow Processing Primitives (FFPP) library, version 2.11.3. Official repository: https://gitlab.com/ant010ff/ffpp Licensed under the MIT License <http://opensource.org/licenses/MIT>. SPDX-License-Identifier: MIT Copyright (c) 2021 - 2026 Anton Nasonov <ant010fff @ gmail . com> */ #ifndef FFPP_FUNCTION_HPP #define FFPP_FUNCTION_HPP namespace FFPP { namespace dtl { template<bool t_bUnique> struct FunctionSelector { template<typename TSignature> using Type = std::function<TSignature>; }; #if FFPP_UNIQUE_FUNCTION template<> struct FunctionSelector<true> { template<typename TSignature> using Type = std::move_only_function<TSignature>; }; #else #ifdef FU2_INCLUDED_FUNCTION2_HPP_ #ifndef FFPP_FU2_UNIQUE_FUNCTION #define FFPP_FU2_UNIQUE_FUNCTION (1) #endif //Using fu2::unique_function by Denis Blank as a replacement for std::move_only_function. In case of VS2022 17.9.5 //(MSVC 19.39.33523) its performance appeared to be inferior to std::move_only_function according to synthetic tests. template<> struct FunctionSelector<true> { template<typename TSignature> using Type = fu2::unique_function<TSignature>; }; #else #if FFPP_ENABLE_DEBUG #pragma message("FFPP warning: std::move_only_function is not available in current build. Consider including function2 (https://github.com/Naios/function2) before ffpp.hpp or upgrade your toolchain to C++ 23 compliant.") #endif template<> struct FunctionSelector<true> { template<typename TSignature> using Type = std::function<TSignature>; }; #endif #endif }//dtl template<typename TSignature, bool t_bUnique = true> using Function = dtl::FunctionSelector<t_bUnique>::template Type<TSignature>; }//FFPP #endif//FFPP_FUNCTION_HPP