Topic: [Q] Templates in namespaces?
Author: ajb@panix.com (Atman Binstock)
Date: 1995/11/15 Raw View
In article <ACCCFC90966811A2B6@corf.demon.co.uk>,
Sean A Corfield <sean@corf.demon.co.uk> wrote:
>Templates can indeed be placed in namespaces. The current WP says that
>specialisations of such templates must also go inside the same namespace:
>
Can a namespace be a template argument?
ex:
template<namespace N> void f()
{
N::Fast_real r;
//...
>The other major issue which has an impact on templates & namespaces is name
>injection -- the committee are debating this subject at the moment.
What is name injection??
Thanks,
Atman Binstock
ajb@panix.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Author: Tony Coates <coates@mailbox.uq.oz.au>
Date: 1995/11/11 Raw View
Can anyone tell me (hope this isn't a FAQ ...) what the status is on whether
templates can be placed in namespaces? My understanding was this was a matter
of recent debate, with some compilers currently making all template definitions
global. For my own part, I think it would be a sad decision to make template
definitions compulsorily global, and hence effectively downgrade template
definitions with respect to non-template definitions.
Cheers,
Tony.
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Author: Sean A Corfield <sean@corf.demon.co.uk>
Date: 1995/11/13 Raw View
In article <481d4h$fr7@dingo.cc.uq.oz.au>,
Tony Coates <coates@mailbox.uq.oz.au> wrote:
|> Can anyone tell me (hope this isn't a FAQ ...) what the status is on
|> whether templates can be placed in namespaces? My understanding was
|> this was a matter of recent debate, with some compilers currently
|> making all template definitions global. For my own part, I think it
|> would be a sad decision to make template definitions compulsorily
|> global, and hence effectively downgrade template definitions with
|> respect to non-template definitions.
Templates can indeed be placed in namespaces. The current WP says that
specialisations of such templates must also go inside the same namespace:
namespace Lib {
template<typename T> class X { };
}
// must reopen namespace to define specialisation
namespace Lib {
template<> class X<int> { };
}
[note: the example uses recently adopted syntax 'typename' as an
alternative to 'class' and 'template<>' to introduce a specialisation]
The other major issue which has an impact on templates & namespaces is name
injection -- the committee are debating this subject at the moment.
Sean A. Corfield
Object Consultancy Services -- voting member of X3J16
C++ - Beyond the ARM http://uptown.turnpike.net/~scorf/cplusext.html
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]