|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-02-18 11:12:52
I'd like to see some form of named/keyword parameters for template
parameters and perhaps also function parameters. The lack of this has made
parts of the boost graph library very difficult to design and implement.
As posted earlier, there's a difficulty in trying to shoehorn named
parameters into the current framework, because parameters names currently
don't mean anything, only position does. Take for example:
template <typename A = char, typename B = int> class foo;
...
template <typename B = char, typename A = int> class foo;
foo<B=int> // what does this mean?
However, another approach would to keep templates that use named
parameters separate from old-style positional parameter templates. This
could be done using different syntax. I suppose throwing another keyword
like "explicit" in there would do the trick. If someone has a better idea
I'm all ears. So here's one possibility:
explicit template <typename A = char, typename B = int> class foo;
...
// the next line is illegal: names, positions, and defaults must all match
explicit template <typename B = char, typename A = int> class foo;
foo<B=float> // Ok, and A gets default, so A=char
Cheers,
Jeremy
On Mon, 18 Feb 2002, Herb Sutter wrote:
hsutte> Hi folks,
hsutte>
hsutte> Pardon if this has already been discussed on the list, but I'd like your
hsutte> feedback on this question: "What are the most needed or desired features in
hsutte> C++ for modern library writing in general and Boost in particular?"
hsutte>
hsutte> Two usual suspects:
hsutte> - typedef templates
hsutte> - typeof (with gcc semantics?)
hsutte>
hsutte> What else should be on the list? For example, is there language support that
hsutte> would assist type traits?
hsutte>
hsutte> Thanks,
hsutte>
hsutte> Herb
hsutte>
hsutte>
hsutte> Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>
hsutte>
hsutte> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
hsutte>
hsutte>
----------------------------------------------------------------------
Jeremy Siek http://php.indiana.edu/~jsiek/
Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk