Perhaps I am misusing template but I want to write a template that
creates a class and in the class are three functions, <foo>_set,
<foo>_clr, <foo>_tst. So if I invoke the template with a name like
'mask', three methods would be created called mask_set, mask_clr, and
mask_tst. In the old CPP world, you could use ## (or was it just #?).
I don't think I can use that in templates because the CPP pass is
before the compiler.
Thanks 2 1271 px******@yahoo.com wrote: Perhaps I am misusing template but I want to write a template that creates a class and in the class are three functions, <foo>_set, <foo>_clr, <foo>_tst. So if I invoke the template with a name like 'mask', three methods would be created called mask_set, mask_clr, and mask_tst. In the old CPP world, you could use ## (or was it just #?). I don't think I can use that in templates because the CPP pass is before the compiler.
You're correct. This preprocessor trick is still there for you to use,
templates, however, are not meant for that.
V
--
Please remove capital As from my address when replying by mail px******@yahoo.com schrieb: Perhaps I am misusing template but I want to write a template that creates a class and in the class are three functions, <foo>_set, <foo>_clr, <foo>_tst. So if I invoke the template with a name like 'mask', three methods would be created called mask_set, mask_clr, and mask_tst. In the old CPP world, you could use ## (or was it just #?). I don't think I can use that in templates because the CPP pass is before the compiler.
Thanks
Question: why do you want to create functions named like that and not
simply set, clr, tst?
In C you had to do such things because there was no overloading. But do
you need it in C++?
Lars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vince C. |
last post by:
Hi all,
I've created XML documents that are described with a schema. I'm using those
documents to create web pages.
All my web pages contain a fixed header and a variable document part. The...
|
by: Tom Alsberg |
last post by:
Hi there...
I'm recently trying to get a bit acquainted with XML Schemas and XSL.
Now, I have a few questions about XSL stylesheets and templates:
* Is there a way to "enter" a child element...
|
by: E. Robert Tisdale |
last post by:
According to the C++ FAQ Lite:
http://www.parashift.com/
What is "genericity"?
Yet another way to say, "class templates."
Not to be confused with "generality"
(which just means avoiding...
|
by: WittyGuy |
last post by:
Hi,
What is the major difference between function overloading and function
templates?
Thanks!
http://www.gotw.ca/resources/clcm.htm for info about ]
|
by: jimbo_vr5 |
last post by:
Hey
I think i've figured out the idea behind apply-templates. But going
through the tutorial on
<http://www.w3schools.com/xsl/xsl_apply_templates.asp> theres simply
just something that i dont...
|
by: Ted |
last post by:
I'm putting the posts that follow here (hopefully they will follow here!) because
they were rejected in comp.lang.c++.moderated. It behooves anyone reading
them to first read the the thread of the...
|
by: NewToCPP |
last post by:
Hi,
I am just trying to find out if there is any strong reason for not
using Templates. When we use Templates it is going to replicate the
code for different data types, thus increasing the...
|
by: JohnQ |
last post by:
Well apparently not since one can step thru template code with a debugger.
But if I was willing to make the concession on debugging, templates would be
strictly a precompiler thing? I have a...
|
by: Chris |
last post by:
Hi All,
This is a weird one but I am hoping someone can help or has some
pointers, a recipe how to do the following:
I have to move some code from c++ to objective-c and to do this I must...
|
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,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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: 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...
|
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,...
|
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: 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...
| |