Thread View: comp.std.c++
2 messages
2 total messages
Started by David Byrden
Thu, 22 Feb 1996 20:22
Templates; what does the standard mean here...
Author: David Byrden
Date: Thu, 22 Feb 1996 20:22
Date: Thu, 22 Feb 1996 20:22
36 lines
1792 bytes
1792 bytes
From the January draft standard:
1 A template can be referred to by a template-id:
template-id:
template-name < template-argument-list >
template-name:
identifier
template-argument-list:
template-argument
template-argument-list , template-argument
template-argument:
assignment-expression
type-id
template-name
Notice the third-last line, "assignment-expression".
Call me dumb, but I must ask what does this mean? What does the
expression specify, a type or a value? Will an assignment be made at run
time?
Can you give me any examples of templates specialised with an
assignment-expression?
Thankyou.
David
---
[ To submit articles: try just posting with your news-reader.
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.
]
Re: Templates; what does the standard mean here...
Author: David Vandevoorde
Date: Sat, 24 Feb 1996 17:15
Date: Sat, 24 Feb 1996 17:15
40 lines
2065 bytes
2065 bytes
>>>>> "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
]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads