summaryrefslogtreecommitdiff
path: root/indra/llcommon/function_types.h
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-12-14 14:12:01 -0600
committerRunitaiLinden <davep@lindenlab.com>2023-12-14 14:12:01 -0600
commit3c858d7e2d6633df14df473a918d2fb848403972 (patch)
tree62b36692a0c1df2f34a85bc7fd4111afb2737d81 /indra/llcommon/function_types.h
parent8b86e2ad1b1326cb3e98acd857dc93f4f1455b8c (diff)
parent32de0cb67d824498d0fc9d489ce19731ebfddfdf (diff)
Merge branch 'DRTVWR-601' of github.com:secondlife/viewer into DRTVWR-601
Diffstat (limited to 'indra/llcommon/function_types.h')
-rw-r--r--indra/llcommon/function_types.h49
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) */