
On Mon, Nov 7, 2011 at 5:56 AM, Daniel Wallin <daniel@boostpro.com> wrote:
On Wed, Nov 2, 2011 at 2:00 PM, Lorenzo Caminiti <lorcaminiti@gmail.com>wrote:
Do you see any problem in using extra template parameter to define the argument pack and named template parameters?
This is similar to what I want to do for the C++11 Boost.Parameter with functions:
template < class... Args, class Pack = typename make_pack<parameters, Args...>::type > void f(Args&&... args) { Pack pack(args...); int x = pack[_x]; }
In the case of class templates, the downside would be that the error messages would be pretty horrible if the user passes too many arguments. I guess it would be possible to guard a bit against that though, and possibly make the error messages better.
A couple more things:
1) I thing that BOOST_PARAMETER_TEMPLATE_KEYWORD(ClassType) macro should define a symbol _ClassType to be used for the named parameter so to be consistent with the BOOST_PARAMETER_NAME(x) which defined _x to be used for the named function parameter. However, ClassType is defined without the leading _. What is the reason for this asymmetry?
We simply preferred making the names less ugly over consistency with function parameters.
2) I'd expect a macro that allows to specify tag and passing argument
name for template parameters BOOST_PARAMETER_TEMPLATE_KEYWORD((PassClassType, mytag) ClassType) as for BOOST_PARAMETER_NAME((pass_x, mytag) x) does for function parameters. Why is such a usage of BOOST_PARAMETER_TEMPLATE_KEYWORD not supported?
Nobody implemented it. No real reason not to support it.
Thanks a lot Daniel! Then I will implement all these features in my integration of Boost.Parameter and Boost.Contract. Also, can you please take a look at why I can't use tag::graph::_ in the DFS example? I really have _no_ idea on how to fix that and I'd need your help... http://boost.2283326.n4.nabble.com/boost-parameter-type-requirement-compiler... For C++11 Boost.Parameter you might want to take a look at what I'll try to do for constructors: https://svn.boost.org/svn/boost/sandbox/contract/libs/contract/doc/html/cont... --Lorenzo