diff options
| author | Signal Linden <signal@lindenlab.com> | 2023-11-21 08:07:20 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-21 08:07:20 -0800 |
| commit | 5416d94d07ac85ba384fafb0b0b1b11b8cd0b6e4 (patch) | |
| tree | 1c4fd503f43d628dd6223af44aa14921357ae0ab /indra/llcommon/function_types.h | |
| parent | 9b50c50bf2fe3fab2dbb0bcd18d7c8f5b9a13a1b (diff) | |
| parent | 62c7a17604ba4faec989465a374e7ed7627ec56b (diff) | |
Merge branch 'DRTVWR-587-maint-V' into signal/simple-release
Diffstat (limited to 'indra/llcommon/function_types.h')
| -rw-r--r-- | indra/llcommon/function_types.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/indra/llcommon/function_types.h b/indra/llcommon/function_types.h new file mode 100644 index 0000000000..3f42f6d640 --- /dev/null +++ b/indra/llcommon/function_types.h @@ -0,0 +1,49 @@ +/** + * @file function_types.h + * @author Nat Goodspeed + * @date 2023-01-20 + * @brief Extend boost::function_types to examine boost::function and + * std::function + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Copyright (c) 2023, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_FUNCTION_TYPES_H) +#define LL_FUNCTION_TYPES_H + +#include <boost/function.hpp> +#include <boost/function_types/function_arity.hpp> +#include <functional> + +namespace LL +{ + + template <typename F> + struct function_arity_impl + { + static constexpr auto value = boost::function_types::function_arity<F>::value; + }; + + template <typename F> + struct function_arity_impl<std::function<F>> + { + static constexpr auto value = function_arity_impl<F>::value; + }; + + template <typename F> + struct function_arity_impl<boost::function<F>> + { + static constexpr auto value = function_arity_impl<F>::value; + }; + + template <typename F> + struct function_arity + { + static constexpr auto value = function_arity_impl<typename std::decay<F>::type>::value; + }; + +} // namespace LL + +#endif /* ! defined(LL_FUNCTION_TYPES_H) */ |
