Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add optional compile time check #379

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/boost/python/args_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ namespace detail
{
typedef char too_many_keywords[keywords > function_args ? -1 : 1];
};
template <int keywords, int function_args>
struct less_keywords_than_function_arguments
{
typedef char too_few_keywords[(keywords!=0 && keywords < function_args) ? -1 : 1];
};
}
}

Expand Down
8 changes: 7 additions & 1 deletion include/boost/python/make_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ namespace detail
typedef typename detail::error::more_keywords_than_function_arguments<
NumKeywords::value, arity
>::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED;


#ifdef BOOST_PYTHON_NUM_KEYWORDS_EQUALS_ARITY
typedef typename detail::error::less_keywords_than_function_arguments<
NumKeywords::value, arity
>::too_few_keywords assertion2 BOOST_ATTRIBUTE_UNUSED;
#endif

return objects::function_object(
detail::caller<F,CallPolicies,Sig>(f, p)
, kw);
Expand Down