Hi all,
I'd like to have code that looks like the following :
BEGIN(Foo)
ADD(float);
ADD(int);
ADD(char);
END()
I'd like the above code to somehow append each type into a typelist,
which is available as a symbol, i.e. something like (using Loki's
typelists):
typedef NullType FOO1;
typedef Loki::TL::Appen d<FOO1, float>::Result FOO2;
typedef Loki::TL::Appen d<FOO2, int>::Result FOO3;
typedef Loki::TL::Appen d<FOO3, char>::Result FOO4;
typedef FOO4 Foo;
I've been trying to think of various ways to achieve this (e.g. using
boost::preproce ssor, using __LINE__, etc), but where I keep getting
stuck is the fact that I can't have 'variables' in macros. I need to
somehow use the result from one macro as input into another, to call
macros recursively, or to have a 'global' variable that keeps track of
some 'state'.
Any ideas?
Thanks,
Bill
PS I could, in theory, using __COUNTER__ to 'guess' the name of the
_previous_ result. I haven't pursued this much, because __COUNTER__ is
compiler specific :( 1 2087 gr********@yaho o.com wrote:
Hi all,
I'd like to have code that looks like the following :
BEGIN(Foo)
ADD(float);
ADD(int);
ADD(char);
END()
I'd like the above code to somehow append each type into a typelist,
which is available as a symbol, i.e. something like (using Loki's
typelists):
typedef NullType FOO1;
typedef Loki::TL::Appen d<FOO1, float>::Result FOO2;
typedef Loki::TL::Appen d<FOO2, int>::Result FOO3;
typedef Loki::TL::Appen d<FOO3, char>::Result FOO4;
typedef FOO4 Foo;
I've been trying to think of various ways to achieve this (e.g. using
boost::preproce ssor, using __LINE__, etc), but where I keep getting
stuck is the fact that I can't have 'variables' in macros. I need to
somehow use the result from one macro as input into another, to call
macros recursively, or to have a 'global' variable that keeps track of
some 'state'.
Any ideas?
Thanks,
Bill
PS I could, in theory, using __COUNTER__ to 'guess' the name of the
_previous_ result. I haven't pursued this much, because __COUNTER__ is
compiler specific :(
I have done somthing like this before. Look at the "at_factory .h" header
in austria c++.
doxygen here: http://austria.sourceforge.net/dox/h...Factories.html
code here: http://www.google.com/codesearch?hl=...e/at_factory.h This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Suzanne Vogel |
last post by:
Hi,
I've been trying to write a function to test whether one class is
derived from another class. I am given only id's of the two classes.
Therefore, direct use of template methods is not an option.
Let's call the id of a class "cid" (for "class id").
The function signature should look like this:...
|
by: Andrew |
last post by:
I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many...
|
by: Veit Wiessner |
last post by:
I wrote a program that handles the buildcount of projects (gets called
every time I compile a project, it writes a header file which is
#include-ed in the project).
My question is this, is it possible to modify string constants with
preprocessor macros? for now I write every string I need as a #define
in the generated header, when in theory I...
|
by: Chronologic |
last post by:
All,
I have an issue I would like some expert help on.
I understand, or so I believe, that C# does not support the concept of
a "compile time macro". At least not in the sense I'm looking for.
While many users contend that macros are inherently evil, I would
argue that no - they are not, they have a function. That function is...
|
by: The Fox |
last post by:
My VB.NET application will call a remote Web Service function
that returns lots of data for reporting purpose.
The data is finally binding to a DataGrid. It does take time!
Is there any ways to load data from web services incrementally?
e.g, per DataRow? or per 10 DataRow? or Per DataTable? or others?
I just want to let user to view the...
| |
by: robert |
last post by:
Hello,
I want to put (incrementally) changed/new files from a big file tree
"directly,compressed and password-only-encrypted" to a remote backup
server incrementally via FTP,SFTP or DAV.... At best within a closed
algorithm inside Python without extra shell tools.
(The method should work with any protocol which allows somehow read,
write...
|
by: Ray |
last post by:
I am reading Andrei Alexandrescu's book. The ideas presented there sound
really good, but I wonder--is there really a lot of people using it? Or
it's simply too esoteric for mortals?
Cheers
Ray
|
by: Mark Rae |
last post by:
Hi,
Supposing I had a string made up of a person's name followed by their
profession in parentheses e.g.
string strText = "Tiger Woods (golfer)";
and I wanted to extract the portion of the string between the parentheses
i.e. "golfer"
|
by: Thant Tessman |
last post by:
Back before C++ templates, I was taught a trick whereby one built C
macros that built other C macros. I can't remember how the heck we did
it. The problem is that there seems to be no standard way to include a
'#' or '#define' in the output of a macro. The other problem is that we
might have been using some sort of non-standard preprocessor...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |