模板参数顺序问题
boost.python:
Class template class_<T, Bases, HeldType, NonCopyable>
Creates a Python class associated with the C++ type passed as its first parameter. Although it has four template parameters, only the first one is required. The three optional arguments can actually be supplied 【in any order】; Boost.Python determines the role of the argument from its type.
boost.spirit
Order of parameters
As of v1.8.0, the ScannerT, ContextT and TagT can be specified 【in any order】. If a template parameter is missing, it will assume the defaults. Examples:
rule<> rx1;
rule<scanner<> > rx2;
rule<parser_context<> > rx3;
rule<parser_context<>, parser_address_tag> rx4;
rule<parser_address_tag> rx5;
rule<parser_address_tag, scanner<>, parser_context<> > rx6;
rule<parser_context<>, scanner<>, parser_address_tag> rx7;
他们是如何做到模板参数顺序无关这点的? 我看过源代码,没弄明白到底怎么实现的,请高手指教。