
Daniel Wallin <dalwan01@student.umu.se> writes:
David A. Greene wrote:
David Abrahams wrote:
BOOST_NTP (Elemtype); BOOST_NTP_C(Bufsize); BOOST_NTP_C(Stride); BOOST_NTP_C(Iterations);
I don't know what's under the covers of those macros; we've tried to make sure that there's a macro-less interface that's at least reasonably usable, so those would be:
template <class T = int> struct Elemtype_is : parameter::template_keyword<a0_is<>, T> {};
[...]
It's very close to what you specified. I just find something less wordy easier to comprehend. I don't know what a0_is<> is, for example.
a0_is<> was a typo, it's supposed to be:
template <class T = int> struct Elemtype_is : parameter::template_keyword<Elemtype_is<>, T> {};
The point of the T's default value is that we can use Elemtype_is<> as a tag-type for the parameter, instead of having a separate tag.
It's a cute trick but I'm not sure we should be doing it. It permits the user a usage that I wouldn't want to encourage (i.e. she can leave out the template argument) and looks a little misleading, as though we're establishing the default for Elemtype.
typedef typename parameter::binding< params, Elemtype_is<>, int >::type ElemtypeP;
typedef typename parameter::binding< params, Stride_is<>, mpl::int_<1> >::type StrideP;
As I understand it, this both specifies defaults and does the actual mapping between actual arguments and NTP names.
Yes. It's actually quite important to specify the default as late as possible, because defaults can depend on the values of other arguments.
A very good point. -- Dave Abrahams Boost Consulting www.boost-consulting.com