I unable to pass a template type with two parameters to a very simple
macro with g++ 3.4 (Linux x86):
for example:
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE(token)
void foo()
{
THIS_IS_A_MACRO (tracked::Track edBasicType<int >); // this works
THIS_IS_A_MACRO (tracked::Track edBasicType2<in t,char>); // this
doesn't
// g++ complains this: macro "THIS_IS_A_MACR O" passed 2 arguments,
but takes just 1
}
Is there a way to pass templatized types (with multiple params) to a
macro definition ?
thanks in advance.
MB 5 6358 ma************@ gmail.com wrote:
I unable to pass a template type with two parameters to a very simple
macro with g++ 3.4 (Linux x86):
for example:
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE(token)
void foo()
{
THIS_IS_A_MACRO (tracked::Track edBasicType<int >); // this works
THIS_IS_A_MACRO (tracked::Track edBasicType2<in t,char>); // this
doesn't
// g++ complains this: macro "THIS_IS_A_MACR O" passed 2 arguments,
but takes just 1
}
Is there a way to pass templatized types (with multiple params) to a
macro definition ?
I'm not sure if it will work, but you could try
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE((token))
(note the extra set of parentheses around 'token').
--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Marcus Kwok wrote :
ma************@ gmail.com wrote:
>I unable to pass a template type with two parameters to a very simple macro with g++ 3.4 (Linux x86):
for example:
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE(token)
void foo() { THIS_IS_A_MACRO (tracked::Track edBasicType<int >); // this works
THIS_IS_A_MACRO (tracked::Track edBasicType2<in t,char>); // this doesn't
// g++ complains this: macro "THIS_IS_A_MACR O" passed 2 arguments, but takes just 1
}
Is there a way to pass templatized types (with multiple params) to a macro definition ?
I'm not sure if it will work, but you could try
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE((token))
(note the extra set of parentheses around 'token').
The error is in using THIS_IS_A_MACRO with 2 parameters, while it
expects one. Changing the "implementation " of THIS_IS_A_MACRO won't
change anything.
- Sylvester
Sylvester Hesp <s.******@spamo isyn.nlwrote:
Marcus Kwok wrote :
>ma************@ gmail.com wrote:
>>I unable to pass a template type with two parameters to a very simple macro with g++ 3.4 (Linux x86):
for example:
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE(token)
void foo() { THIS_IS_A_MACRO (tracked::Track edBasicType<int >); // this works
THIS_IS_A_MACRO (tracked::Track edBasicType2<in t,char>); // this doesn't
// g++ complains this: macro "THIS_IS_A_MACR O" passed 2 arguments, but takes just 1
}
Is there a way to pass templatized types (with multiple params) to a macro definition ?
I'm not sure if it will work, but you could try
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE((token))
(note the extra set of parentheses around 'token').
The error is in using THIS_IS_A_MACRO with 2 parameters, while it
expects one. Changing the "implementation " of THIS_IS_A_MACRO won't
change anything.
What about changing the call site to add the extra parentheses there:
THIS_IS_A_MACRO ((tracked::Trac kedBasicType2<i nt,char>));
If that works, then you might be able to get more natural syntax by
adding another level of macro indirection. I recall a similar technique
we used in a C course to wrap printf() calls with a macro that expanded
to another macro, so that lint wouldn't complain when we didn't check
the return value, but the exact details escape me at the moment.
--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Marcus Kwok <ri******@gehen nom.invalidwrot e:
What about changing the call site to add the extra parentheses there:
THIS_IS_A_MACRO ((tracked::Trac kedBasicType2<i nt,char>));
If that works, then you might be able to get more natural syntax by
adding another level of macro indirection. I recall a similar technique
we used in a C course to wrap printf() calls with a macro that expanded
to another macro, so that lint wouldn't complain when we didn't check
the return value, but the exact details escape me at the moment.
OK, I was able to find it and I was wrong; the "trick" we used was to
use the double-parentheses so that the variable number of arguments to
printf() could be passed to the second intermediate macro.
--
Marcus Kwok
Replace 'invalid' with 'net' to reply
It works using extra parentheses, thanks !!!!
MB
On May 24, 12:56 pm, ricec...@gehenn om.invalid (Marcus Kwok) wrote:
Sylvester Hesp <s.hes...@spamo isyn.nlwrote:
Marcus Kwok wrote :
martin.brod...@ gmail.com wrote: I unable to pass a template type with two parameters to a very simple macro with g++ 3.4 (Linux x86):
>for example:
>#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE(token)
>void foo() { THIS_IS_A_MACRO (tracked::Track edBasicType<int >); // this works
> THIS_IS_A_MACRO (tracked::Track edBasicType2<in t,char>); // this doesn't
> // g++ complains this: macro "THIS_IS_A_MACR O" passed 2 arguments, but takes just 1
>}
>Is there a way to pass templatized types (with multiple params) to a macro definition ?
I'm not sure if it will work, but you could try
#define THIS_IS_A_MACRO (token) BOOST_PP_STRING IZE((token))
(note the extra set of parentheses around 'token').
The error is in using THIS_IS_A_MACRO with 2 parameters, while it
expects one. Changing the "implementation " of THIS_IS_A_MACRO won't
change anything.
What about changing the call site to add the extra parentheses there:
THIS_IS_A_MACRO ((tracked::Trac kedBasicType2<i nt,char>));
If that works, then you might be able to get more natural syntax by
adding another level of macro indirection. I recall a similar technique
we used in a C course to wrap printf() calls with a macro that expanded
to another macro, so that lint wouldn't complain when we didn't check
the return value, but the exact details escape me at the moment.
--
Marcus Kwok
Replace 'invalid' with 'net' to reply
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: andreas |
last post by:
Hi there,
I have the following situation:
1. DOT.NET Application is started
2. DOT.NET Application instantiates Access.Application.8
3. Opens a specified database (MDB)
4. DOT.NET application sets a global variable in the access
application to itself (type object)
5. Runs a macro
|
by: Rich |
last post by:
Hi,
I have a query regarding VC6 and its handling of templated copy
constructors. Here goes:
Take a look at the following code sample...
template<class _Ty, size_t t_uiSize = 10 >
class my_template
|
by: truckaxle |
last post by:
I am trying to pass a slice from a larger 2-dimensional array to a
function that will work on a smaller region of the array space. The
code below is a distillation of what I am trying to accomplish.
// - - - - - - - - begin code - - - - - - -
typedef int sm_t;
typedef int bg_t;
sm_t sm;
bg_t bg;
|
by: MSDNAndi |
last post by:
Hi,
I get the following warning:
"Possibly incorrect assignment to local 'oLockObject' which is the argument
to a using or lock statement. The Dispose call or unlocking will happen on
the original value of the local."
My code is:
using System;
using System.Collections.Generic;
|
by: Andrew Bullock |
last post by:
Hi,
I have two classes, A and B,
B takes an A as an argument in its constructor:
A a1 = new A();
B b = new B(a1);
| |
by: =?Utf-8?B?UmF2aQ==?= |
last post by:
Hi,
I'm trying to pass values of different data-types to a web-service. I
thought it would be easier to box these values and pass them as a
System.object parameter, like
public void webmethod1(object a)
where a can be of type string, DateTime, float, etc..
|
by: David Sanders |
last post by:
Hi,
I have a class depending on a template parameter:
template<int n>
class MyClass {
};
I want the template parameter to be chosen according to a variable,
e.g.
|
by: osama178 |
last post by:
Let's say I have this code
--------------------
class GenericQueue
{
public:
bool Pop(void*& refToPtr); // //--------------------(1)
};
|
by: SRoubtsov |
last post by:
Dear all,
Do you know whether ANSI C (or some other dialects) support the
following:
* a variable name coincides with a type name,
* a structure/union field name coincides with a type name
in the same file (.c + all relevant .h's)?
e.g.
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |