473,388 Members | 1,408 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,388 software developers and data experts.

Alias de template comme parametre de fonction template

Bonjour,

dans mon programme j'ai défini le type SmartPtr ainsi :

#include <boost/shared_ptr.hpp>

template<typename T>
struct SmartPtr
{
typedef boost::shared_ptr<T> Type ;
};

afin de pouvoir éventuellement changer de smart ptr plus tard.
Je défini mes types smart ptr ainsi :

typedef SmartPtr<int>::Type IntPtr;

Ok ça marche bien.
Problème : j'arrive pas à utiliser cet alias SmartPtr pour la détection
automatique des types dans les templates:

template<typename T>
void test( typename SmartPtr<T>::Type ptr )
{
*ptr = 10;
}

VC++ 7.1 n'est pas content :

'void test(SmartPtr<T>::Type)' : impossible de déduire l'argument de
modèle de 'T'

si je met boost::shared_ptr à la place ça marche :

template<typename T>
void test2( boost::shared_ptr<T> ptr )
{
*ptr = 10;
}

Mais j'aimerais bien faire pareil avec mon SmartPtr. Est-ce possible ?

Merci.

--
Aurélien REGAT-BARREL
Jul 23 '05 #1
1 1796
Sorry, I posted on the wrong group.
Jul 23 '05 #2

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

Similar topics

14
by: John | last post by:
Hi all, I am doing the change from having worked in Oracle for a long time to MS SQL server and am frustrated with a couple of simple SQL stmt's. Or at least they have always been easy. The...
3
by: Chris | last post by:
function Main(param) { alert("test "+param); <<<<<<<<<<< Ici tout se passe bien : le contenu de param est bien affiché fchaine='' .... +'<div ><a href="#" onclick="javascript:return...
2
by: tom horner | last post by:
Any ideas on why drop and create alias statements would take a long time? We recently went through an upgrade of our production database, which included alter statements to table structures,...
6
by: rAinDeEr | last post by:
Hi, An alias is an alternate name for a table or a view. Now, suppose I create an alias on a non existent table in the control centre , it gives me a warning but it still creates the alias for...
6
by: aliassaf | last post by:
Hello, If we write = x^2 and if I give to the program the values of x, it will going to calculate the values of y, and also for x. But it is possible ? that is if I give to the program the...
56
by: Peter Olcott | last post by:
I am trying to refer to the same std::vector in a class by two different names, I tried a union, and I tried a reference, I can't seem to get the syntax right. Can anyone please help? Thanks
4
by: aaragon | last post by:
Hi everyone, I wrote some code for a class but then I decided that I wanted to inherit from this class. Well, it turns out that now I have to put "this->" in front of all the member variables of...
9
by: lnatz | last post by:
Hi, I am writing a shell for a class and I have to write some builtins such as alias and cd. I am having some trouble with alias. I anyone could give me some ideas about how to do it I would...
1
by: dwasler | last post by:
Try every thing I know to remove this alias I know there been other posting I read each one none seem to work. Thank You DLWasler dwasler@yahoo.com OS Window db2 V 8.2.X
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.