diff options
| author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2024-01-24 14:37:33 -0800 |
|---|---|---|
| committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2024-01-24 14:37:33 -0800 |
| commit | 373b06398c274eee476e4aa9c35b9c6327f9d45f (patch) | |
| tree | 4a324b36ab896d9507374e71e15f9ec064b41add /indra/llcommon/function_types.h | |
| parent | bd9c0a2e658e183bb8a321cdce546f10b6d76afe (diff) | |
| parent | c22aefafb3d05be37965361913c02568fa10adf6 (diff) | |
Merge remote-tracking branch 'origin/release/materials_featurette' into DRTVWR-583
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) */ |
