|
Boost : |
From: Emily Winch (emily_at_[hidden])
Date: 2002-02-18 03:57:28
Herb Sutter wrote:
> Pardon if this has already been discussed on the list, but I'd like your
> feedback on this question: "What are the most needed or desired features
in
> C++ for modern library writing in general and Boost in particular?"
>
> Two usual suspects:
> - typedef templates
> - typeof (with gcc semantics?)
>
> What else should be on the list? For example, is there language support
that
> would assist type traits?
"Auto" for type deduction.
template<typename T, int I>
auto foo(); // return type depends on T and I
auto bar = foo<int, 4>();
Writing complex template code is unpleasant without it - you have to write
almost duplicate code: one function to calculate the return type, one to
calculate the return value. Using the code is also more complicated than it
needs to be, since to declare a variable to hold the return value you have
to look up the name of the function that calculates the return type.
get_foo_return_type<int, 4>::type bar = foo<int 4>(); // yuk
Emily
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk