473,399 Members | 3,656 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,399 software developers and data experts.

Does this already exist?

I needed this functionality and couldn't find it. Does anyone know if
it already exists somewhere? If so I would rather use the existing
method instead of my own...
template < typename T >
struct dereference_type { typedef T type; };

template < typename T >
struct dereference_type< T* { typedef T type; };

template < typename T >
struct dereference_type< boost::scoped_ptr< T { typedef T type;
};

template < typename T >
struct dereference_type< boost::shared_ptr< T { typedef T type;
};

template < typename T >
struct dereference_type< boost::weak_ptr< T { typedef T type; };

Nov 20 '06 #1
2 1170

Noah Roberts wrote:
I needed this functionality and couldn't find it. Does anyone know if
it already exists somewhere? If so I would rather use the existing
method instead of my own...
template < typename T >
struct dereference_type { typedef T type; };

template < typename T >
struct dereference_type< T* { typedef T type; };
The above two are pretty generic practice I know sor sure but probably
not present in any generic header file. I have been using them in my
own code for a while.
I am not sure if it is present in Boost because I dont use it much.
>
template < typename T >
struct dereference_type< boost::scoped_ptr< T { typedef T type;
};

template < typename T >
struct dereference_type< boost::shared_ptr< T { typedef T type;
};

template < typename T >
struct dereference_type< boost::weak_ptr< T { typedef T type; };
Nov 20 '06 #2

ampar...@gmail.com wrote:
Noah Roberts wrote:
I needed this functionality and couldn't find it. Does anyone know if
it already exists somewhere? If so I would rather use the existing
method instead of my own...
template < typename T >
struct dereference_type { typedef T type; };

template < typename T >
struct dereference_type< T* { typedef T type; };

The above two are pretty generic practice I know sor sure but probably
not present in any generic header file. I have been using them in my
own code for a while.
I am not sure if it is present in Boost because I dont use it much.
Yeah, I guess I should have clarified. Looking for it in std or
boost...more likely boost as I need it to work with the boost ptr
types. On the other hand, if it exists in std it wouldn't be hard to
override for boost ptr types.

Nov 20 '06 #3

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

Similar topics

4
by: Daniel Polansky | last post by:
Is there a way to open file for writing so that the opening fails if the file already exist? This needs to be atomic operation so that it is possible to use the file as a semaphore. As a result,...
3
by: toedipper | last post by:
Hello, PHP and MYSql I have the code below which logs a visitor to my site via logging the session id and other details in a table. I only want to count a visit once so I have a check to see...
8
by: Hasani | last post by:
OK, I'm trying to programmatically create an Access database/mdb file but CreateDb(string) always returns false. I don't know what I'm doing wrong, is it my extern signature? Thx in advance ...
13
by: Peteroid | last post by:
Why does reading a member of a std::map not considered const? For example: class My_Class { int Get_Map_Value( int index ) const // ** error ** not considered const!!! { return m_Map ; //...
6
by: kwdavids | last post by:
I'm getting occasional instances of the error: SQL Server does not exist or access denied I get the error both in application code and from Enterprise Manager. The database is LOCAL. ...
3
by: sammyloo | last post by:
Hi all, I'm experiencing a problem using ASP.NET web services to access a different server with SQL Server 2000 database. And I get the error of the following Exception Details:...
1
by: vamshika | last post by:
hi, I got a serious Problem. I get "Server does not exist or access denied" with 80004005 as the error code. the win2003 server uses all the latest components(like iis6,jet..etc) and is upto date....
113
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
19
by: Angus | last post by:
I have a socket class CTestClientSocket which I am using to simulate load testing. I create multiple instances of the client like this: for (int i = 0; i < 5; i++) { CTestClientSocket* pTemp...
25
by: tooru honda | last post by:
Hi, I have read the source code of the built-in random module, random.py. After also reading Wiki article on Knuth Shuffle algorithm, I wonder if the shuffle method implemented in random.py...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.