|
Boost : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-08-05 21:06:26
[moderator: this might be a bit off-topic, sorry]
Douglas Gregor wrote:
> On Aug 5, 2006, at 3:04 PM, Ion Gaztañaga wrote:
>
>> -> First-class parameter packs
>
> Will not be implemented. There are serious technical problems with
> implementing first-class parameter packs that we had not foreseen. In
> particular, to do a decent job of making sure parameter packs are
> used properly when a template is defined, you need to know *exactly*
> which things are parameter packs and which things aren't. With first-
> class parameter packs, you don't always have this information because.
Umm. Native tuple without needing recursive instantiation trick was a
very good idea to speed up compilation. Maybe the next time!
>> -> Initializer lists are parameter packs
>
> Still thinking about this one. It looks like it might be a good idea.
In your vector example, the parameter list is introduced with a
recursive function:
template<typename T>
class vector {
public:
template<typename... Values>
vector(const Values&... values) {
reserve(sizeof(values...));
push back all(values...);
}
private:
void push_back_all() { }
template<typename... Values>
void push_back_all(const T& value, const Values&... values) {
push_back(value);
push_back_all(values...);
}
};
It would nice (just an idea) to have a way to execute an expression for
every parameter, just like it was a function unrolling, implemented with
with macros:
template<typename... Values>
void push back all(const T& value, const Values&... values) {
std::variadic_unroll(push_back(value));
}
Just an idea for the future. I don't know if implementing this is too
difficult. That would help with compilation time.
>> Lots of good stuff implemented
*Very* nice work. Looks impressive.
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk