[C++-sig] Re: return_self_policy
Nikolay Mladenov
nickm at sitius.com
Tue Jun 24 15:41:23 CEST 2003
David Abrahams wrote:
>
> Nikolay Mladenov ?nickm at sitius.com? writes:
>
> ? Posting return_self policy implementation
> ?
> ? Nikolay'''
>
> Nikolay,
>
> This is wonderful! Now, I hate to do this, but I just realized that
> this should really be generalized to something which takes an
> argument number as its parameter and returns that argument:
I have already thought about it (I expected it from you ;-) )
and it is already there in some form:
the definition of return_self_policy is
template<class Base>
struct return_self_policy :
detail::return_arg<0, Base> {}
>
> return_identity?0? // error
> return_identity??, return_identity?1? // same as return_self_policy
> return_identity?2? // return the 2nd argument
> return_identity?3? // return the 3rd argument
> ...
>
> etc.
So return_arg is as your return_identity, although return_arg<0> is not
an error but return_self.
>
> Don't you think that makes more sense? Would you mind making this
> modification?
I agree that it makes more sense, but I am not sure how much the "more"
is.
Generally I don't mind.
>
> Thoughts, objections, screaming...?
My question is: why start counting from 1? This will make the code more
complicated and difficult to read.
>
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
Regards,
Nikolay
More information about the Cplusplus-sig
mailing list