Re: Type of initializer lists ( N2215 feedback)
On Apr 14, 12:02 am, "Vidar Hasfjord" <vattilah-gro...@yahoo.co.uk>
wrote:
This demonstrates that the full type of an initializer list (i.e. the
number and types of the elements) can be captured and processed by the
language. Hence I guess I can allay my primary concern about the
initializer lists proposal.
Scratch that. My primary fear about the initializer list proposal is
back in full force!
I suggested:
template <typename... Args>
array <typename common_type <Args...>::type, sizeof Args>
make_array (tuple <Args...>);
The problem with the above is that the tuple type cannot be deduced
from the initalizer list argument (it would require deduction of class
template arguments based on constructor arguments, which is not in the
current language nor planned for C++09, AFAIK). Hence the user must
specify the type of the tuple to use the function. For example:
auto a = make_array (tuple <int, int> {1, 2});
Which makes the factory function useless.
So I'm back were I started. I can't see a way to directly capture the
size and element types (i.e. all the type info) of an initializer
list.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]