|
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 |
|
@@ -65,10 +66,11 @@ namespace detail |
65 | 66 | { |
66 | 67 | namespace error |
67 | 68 | { |
| 69 | + /// @deprecated |
68 | 70 | template <int keywords, int init_args> |
69 | 71 | struct more_keywords_than_init_arguments |
70 | 72 | { |
71 | | - typedef char too_many_keywords[init_args - keywords >= 0 ? 1 : -1] BOOST_ATTRIBUTE_UNUSED; |
| 73 | + BOOST_STATIC_ASSERT(keywords <= init_args); |
72 | 74 | }; |
73 | 75 | } |
74 | 76 |
|
@@ -222,18 +224,14 @@ class init : public init_base<init<BOOST_PYTHON_OVERLOAD_ARGS> > |
222 | 224 | init(char const* doc_, detail::keywords<N> const& kw) |
223 | 225 | : base(doc_, kw.range()) |
224 | 226 | { |
225 | | - typedef typename detail::error::more_keywords_than_init_arguments< |
226 | | - N, n_arguments::value + 1 |
227 | | - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; |
| 227 | + BOOST_STATIC_ASSERT(N <= n_arguments::value + 1); |
228 | 228 | } |
229 | 229 |
|
230 | 230 | template <std::size_t N> |
231 | 231 | init(detail::keywords<N> const& kw, char const* doc_ = 0) |
232 | 232 | : base(doc_, kw.range()) |
233 | 233 | { |
234 | | - typedef typename detail::error::more_keywords_than_init_arguments< |
235 | | - N, n_arguments::value + 1 |
236 | | - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; |
| 234 | + BOOST_STATIC_ASSERT(N <= n_arguments::value + 1); |
237 | 235 | } |
238 | 236 |
|
239 | 237 | template <class CallPoliciesT> |
|
0 commit comments