|
Boost : |
From: Thomas Witt (witt_at_[hidden])
Date: 2003-07-09 13:55:40
On Wednesday 09 July 2003 19:43, David Abrahams wrote:
> I strongly prefer this interface:
Me too.
>
> // enable_if operates on types with a nested ::value
> template <class T>
> typename enable_if<boost::is_arithmetic<T>, void>::type foo(T t) {
> std::cout << "An arithmetic type\n";
> }
>
> template <class T>
> typename disable_if<boost::is_arithmetic<T>, void>::type foo(T t) {
> std::cout << "Not an arithmetic type\n";
> }
>
> // and enable_if_c operates on integral constants:
I doubt that the _c version are needed frequently enough to warrant the extra
types.
Thomas
-- Dipl.-Ing. Thomas Witt Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001 http://www.ive.uni-hannover.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk