473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

templated constructor specialization?

Is this allowed:

struct A{};
struct B{};

class C
{
public:

template< class T > C( int aInt, const T& );

template<> C<A>( int a Int, const A& ){}
template<> C<B>( int a Int, const B& ){}
};

Thanks, Jeff
Jul 22 '05 #1
1 1744
Jeff Flinn wrote:
Is this allowed:

struct A{};
struct B{};

class C
{
public:

template< class T > C( int aInt, const T& );

template<> C<A>( int a Int, const A& ){}
template<> C<B>( int a Int, const B& ){}
};


No. 14.7.3/2 requires them to be declared at the namespace level.

V
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Saulius | last post by:
template<template<typename T> class StoragePolicy> class construction_info { // Empty by default, specialize for other types. }; template<template<typename> class StoragePolicy, typename...
2
by: ferdinand.stefanus | last post by:
Hi, I have some questions regarding templated class constructor: #include <iostream> using namespace std; template<typename T> class Foo { public:
9
by: Jon Wilson | last post by:
I have a class which needs to accumulate data. The way we get this data is by calling a member function which returns float on a number of different objects of different type (they are all the...
3
by: case2005 | last post by:
Can anyone help with the following, I don't know if it's possible, but I'm certain there must be a standard way of dealing with this. I have the following: template<typename FooBar, typename...
6
by: __PPS__ | last post by:
it's ok according to the standard to specialize member function like this: template<class T>struct xxx { void func(); }; template<>bool xxx<int>::func(){ //int version } template<>bool...
6
by: Dan Huantes | last post by:
I was presented a problem today where a class had member variable that was an object of a templated class. The class wanted to instantiate the object as a private member variable and call a...
9
by: muzmail | last post by:
I have declared a copy constructor for a template class in a Visual C++ project but for some reason the compiler ignores it. I can put syntax errors in the copy constructor and the compiler ignores...
12
by: Robert.Holic | last post by:
Hi All (first time caller, long time listener), I've stumbled across a problem that I have yet to figure out, although Im sure I'll kick myself when I figure it out. Here it is: I need to...
7
by: Claudius | last post by:
Hello, in my class TopTen I need to define three constructors while only the last one, the most general in terms of templates, should be sufficient in my opinion: template <typename Tnum,...
2
card
by: card | last post by:
Hi everyone, I have a question about referencing a nested class contained within a templated class. Of course the best way to show you is by example. Here's my templated classes: #include...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.