Topic: Templates; what does the standard mean here...
Author: David Byrden <100101.2547@compuserve.com>
Date: 1996/02/22 Raw View
Author: vandevod@cs.rpi.edu (David Vandevoorde)
Date: 1996/02/24 Raw View
>>>>> "DB" == David Byrden <100101.2547@compuserve.com> writes:
DB> From the January draft standard:
[...]
DB> template-argument:
DB> assignment-expression
DB> type-id
DB> template-name
DB> Notice the third-last line, "assignment-expression".
Assignment expressions are described in Chapter 5 ([expr.assign] or
something similar). They're basically your classical expression with
operation precedence downto assignments (e.g., not a comma-expression).
DB> Call me dumb, but I must ask what does this mean? What does the
DB> expression specify, a type or a value? Will an assignment be made at run
DB> time?
This is for non-type template arguments.
This is only the syntax description. In [temp.arg] you should find
that the expression must be a non-floating-type, constant expression
(i.e., one that can easily be determined at compile-time).
DB> Can you give me any examples of templates specialised with an
DB> assignment-expression?
template<bool B> struct PlaceHolder {};
PlaceHolder<(4<5)> hello_variable;
Daveed
[ To submit articles: Try just posting with your newsreader.
If that fails, use mailto:std-c++@ncar.ucar.edu
FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]