C++ Class with templated and non-templated form

I am curious if it is possible to have a class with both a templated and non-templated form. Something like:

SomeClass foo;
SomeClass<int> bar;


I am fine defining everything more than once, but I don't know if it's possible to use the same class name.


Short answer: no, it's not allowed. The exact error message your compiler gives you will vary, but you should get an error message.

You can, however, provide default parameters for a template, so you can instantiate it with only <>, like:

template <class T=int>
class X {};

int main(){ 
    X<long> a;
    X<>     b; // used default, so equivalent to "X<int> b;"

Need Your Help

Div will not move up to where it should

html css

I have a div inside a div that will not move up into the center where I want it to. It is the image called youthcouncil

How do I fetch n-th row from Cassandra?

limit cassandra rows

I have column family with timestamp as row name and I want to fetch first 10 rows, second 10's, etc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.