|
26 | 26 | #include <boost/mpl/prior.hpp>
|
27 | 27 | #include <boost/mpl/joint_view.hpp>
|
28 | 28 | #include <boost/mpl/back.hpp>
|
| 29 | +#include <boost/static_assert.hpp> |
29 | 30 |
|
30 | 31 | #include <boost/python/detail/type_traits.hpp>
|
31 | 32 |
|
@@ -68,7 +69,7 @@ namespace detail
|
68 | 69 | template <int keywords, int init_args>
|
69 | 70 | struct more_keywords_than_init_arguments
|
70 | 71 | {
|
71 |
| - typedef char too_many_keywords[init_args - keywords >= 0 ? 1 : -1] BOOST_ATTRIBUTE_UNUSED; |
| 72 | + BOOST_STATIC_ASSERT(keywords <= init_args); |
72 | 73 | };
|
73 | 74 | }
|
74 | 75 |
|
@@ -222,18 +223,14 @@ class init : public init_base<init<BOOST_PYTHON_OVERLOAD_ARGS> >
|
222 | 223 | init(char const* doc_, detail::keywords<N> const& kw)
|
223 | 224 | : base(doc_, kw.range())
|
224 | 225 | {
|
225 |
| - typedef typename detail::error::more_keywords_than_init_arguments< |
226 |
| - N, n_arguments::value + 1 |
227 |
| - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; |
| 226 | + BOOST_STATIC_ASSERT(N <= n_arguments::value + 1); |
228 | 227 | }
|
229 | 228 |
|
230 | 229 | template <std::size_t N>
|
231 | 230 | init(detail::keywords<N> const& kw, char const* doc_ = 0)
|
232 | 231 | : base(doc_, kw.range())
|
233 | 232 | {
|
234 |
| - typedef typename detail::error::more_keywords_than_init_arguments< |
235 |
| - N, n_arguments::value + 1 |
236 |
| - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; |
| 233 | + BOOST_STATIC_ASSERT(N <= n_arguments::value + 1); |
237 | 234 | }
|
238 | 235 |
|
239 | 236 | template <class CallPoliciesT>
|
|
0 commit comments