[libsigcplusplus/variadic_mem_fun3: 85/148] bind(): Add a static_assert() for when bind<num> is passed a too-high index.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/variadic_mem_fun3: 85/148] bind(): Add a static_assert() for when bind<num> is passed a too-high index.
- Date: Mon, 7 Mar 2016 10:04:57 +0000 (UTC)
commit 0adbdda901b5de7c06d5e3b0f5e30c94533f77cc
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Mar 2 22:21:18 2016 +0100
bind(): Add a static_assert() for when bind<num> is passed a too-high index.
sigc++/adaptors/bind.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h
index 3a39647..0668da7 100644
--- a/sigc++/adaptors/bind.h
+++ b/sigc++/adaptors/bind.h
@@ -136,6 +136,10 @@ struct bind_functor : public adapts<T_functor>
auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...);
constexpr auto t_args_size = std::tuple_size<tuple_type_args>::value;
+ //Prevent calling tuple_start<> with values that will cause a compilation error.
+ static_assert(I_location < t_args_size,
+ "I_location must be less than the number of arguments.");
+
auto t_start = internal::tuple_start<I_location>(t_args);
auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
auto t_end = internal::tuple_end<t_args_size - I_location>(t_args);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]