diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-03-02 22:21:18 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-03-02 22:21:18 +0100 |
commit | c5e3e60cad44f58e9bc851259b4710033404b90e (patch) | |
tree | e7d5e8a939d5fec64649f1ed9f66dd75d47ae2e4 | |
parent | c29e273cd6be70a3f87cc3bc07b8b2bdceaffe76 (diff) | |
download | sigc++-c5e3e60cad44f58e9bc851259b4710033404b90e.tar.gz |
bind(): Add a static_assert() for when bind<num> is passed a too-high index.
-rw-r--r-- | 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); |