Hi,
Is there a way using templates at compile time to determine if a type
T is a subclass of another type?
Basically I want to chose one struct if it is a subclass, or another
struct if it is not. 5 1740
flopbucket wrote:
Is there a way using templates at compile time to determine if a type
T is a subclass of another type?
Basically I want to chose one struct if it is a subclass, or another
struct if it is not.
Yes, IIRC. Check "is_derived_from" (or something like that) in Boost.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
flopbucket wrote :
Hi,
Is there a way using templates at compile time to determine if a type
T is a subclass of another type?
Basically I want to chose one struct if it is a subclass, or another
struct if it is not.
Yes there is, see boost::is_base_of http://www.boost.org/doc/html/boost_...its.is_base_of
- Sylvester
On Jun 4, 10:27 am, Sylvester Hesp <s.hes...@SPAMoisyn.nlwrote:
flopbucket wrote :
Hi,
Is there a way using templates at compile time to determine if a type
T is a subclass of another type?
Basically I want to chose one struct if it is a subclass, or another
struct if it is not.
Yes there is, see boost::is_base_of
http://www.boost.org/doc/html/boost_...e.html#boost_t...
- Sylvester
Is it possible to do this without using Boost library functions ???
Vaibhav <va***********@gmail.comwrote in news:1180967826.331580.90410
@p77g2000hsh.googlegroups.com:
On Jun 4, 10:27 am, Sylvester Hesp <s.hes...@SPAMoisyn.nlwrote:
>flopbucket wrote :
Hi,
Is there a way using templates at compile time to determine if a type
T is a subclass of another type?
Basically I want to chose one struct if it is a subclass, or another
struct if it is not.
Yes there is, see boost::is_base_of
http://www.boost.org/doc/html/boost_...e.html#boost_t...
- Sylvester
Is it possible to do this without using Boost library functions ???
Sure. Look at how Boost did it... do the same thing.
On 4 juin, 16:14, flopbucket <flopbuc...@hotmail.comwrote:
Hi,
Is there a way using templates at compile time to determine if a type
T is a subclass of another type?
Basically I want to chose one struct if it is a subclass, or another
struct if it is not.
Look at "Modern C++ Design" - Alexandrescu
The whole process is explained (and used in Loki). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Murat Tasan |
last post by:
so i have a situation that i know cannot be solved directly, and i've
already worked around it, but i was hoping to find an explanation as to
why this behavior is as it is... i have an abstract...
|
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing/modifying the code.
Thank you.
.. Facundo
|
by: Stephen Nesbitt |
last post by:
All:
Here's my implementation problem. I have a base class which has the
responsibility for providing entry into the logging system. Part of
the class responsibility is to ensure that lagger...
|
by: Max M |
last post by:
# -*- coding: latin-1 -*-
"""
I subclass datetime and timedelta
>>> dt = myDatetime(1970,1,1)
>>> type(dt)
<class 'dtime.myDatetime'>
|
by: Mark English |
last post by:
I'd like to write a Tkinter app which, given a class, pops up a
window(s) with fields for each "attribute" of that class. The user could
enter values for the attributes and on closing the window...
|
by: Brian van den Broek |
last post by:
Hi all,
The code below exhibits an attempt to refer to the type of a __Class
from within a method of that class. I've been unable to figure out how
to make it work as I want, and would...
|
by: john |
last post by:
I have a situation where i have a base class and a sub-class. A null instance of the sub-class is passed into a function. The function needs to create a new instance of the sub-class, but the...
|
by: René Nordby |
last post by:
Hi there,
Is there anyone that knows how to do the following?
I have a class A and a class B, that 100% inherits from class A (this means
that I don't have other code in class B, than...
|
by: JH |
last post by:
Hi
I found that a type/class are both a subclass and a instance of base
type "object".
It conflicts to my understanding that:
1.) a type/class object is created from class statement
2.) a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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: 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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |