[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Konstante template argumenter i C++



Mads Bondo Dydensborg wrote:

> Hej alle
> 
> Er dette en valid c++ erklæring:
> 
>  template<class T, const std::string & name >
> class osv.
> 
> ?

Ja.

Jeg er ikke sikkert paa om det kan lade sig gøre at fremtvinge et
const template-argument. Standarden siger eksplicit, at template
parameteren maa være mere qualified end template argumentet.

HC
---------------
Fra C++ 98 Standarden:

14.1 Template parameters

A nontype templateparameter shall have one of the following (optionally cvqualified) types:
- integral or enumeration type,
- pointer to object or pointer to function,
- reference to object or reference to function,
- pointer to member.

14.3.2 Template nontype arguments [temp.arg.nontype]

A template argument for a nontype, nontemplate templateparameter shall be one of:
- an integral constantexpression of integral or enumeration type; or
- the name of a nontype templateparameter; or
- the name of an object or function with external linkage, including function templates and function templateids but
  excluding nonstatic class members, expressed as idexpression; or
- the address of an object or function with external linkage, including function templates and function templateids
  but excluding nonstatic class members, expressed as & idexpression where the & is optional if the name refers to a function or array; or
- a pointer to member expressed as described in 5.3.1 .



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-05-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *