I'm reading Modern C++ Design, and it is saying "Variable template
parameters simply don't exist."
But I find VC7.1 & VC8 support this feature.Who can tell me that which is
right -_-b
Many thanks. 11 2528
* Fan Yang:
I'm reading Modern C++ Design, and it is saying "Variable template
parameters simply don't exist."
But I find VC7.1 & VC8 support this feature.Who can tell me that which is
right -_-b
Have you heard about "context"? Some statements have context.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Fan Yang wrote:
I'm reading Modern C++ Design, and it is saying "Variable template
parameters simply don't exist."
aka variadic template parameters
But I find VC7.1 & VC8 support this feature.Who can tell me that which is
right -_-b
I am not aware of any compiler supporting variadic template parameters.
I am sorry, but what's the context?
"Alf P. Steinbach" <al***@start.no >
??????:4t****** *******@mid.ind ividual.net...
>* Fan Yang:
>I'm reading Modern C++ Design, and it is saying "Variable template parameters simply don't exist." But I find VC7.1 & VC8 support this feature.Who can tell me that which is right -_-b
Have you heard about "context"? Some statements have context.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
dasjotre wrote:
Fan Yang wrote:
I'm reading Modern C++ Design, and it is saying "Variable template
parameters simply don't exist."
aka variadic template parameters
But I find VC7.1 & VC8 support this feature.Who can tell me that which is
right -_-b
I am not aware of any compiler supporting variadic template parameters.
However, in practice this type of template can be created for some
upper number of N. Look at many examples from TR1 and Boost (tuple,
MPL, array, etc...). I'd be surprised if that book doesn't describe
these techneques but I haven't read the whole thing and certainly don't
know it by heart so I can't say what part the OP is talking about.
Noah Roberts wrote:
dasjotre wrote:
>Fan Yang wrote:
>>I'm reading Modern C++ Design, and it is saying "Variable template parameters simply don't exist."
aka variadic template parameters
>>But I find VC7.1 & VC8 support this feature.Who can tell me that which is right -_-b
I am not aware of any compiler supporting variadic template parameters.
However, in practice this type of template can be created for some
upper number of N. Look at many examples from TR1 and Boost (tuple,
MPL, array, etc...). I'd be surprised if that book doesn't describe
these techneques but I haven't read the whole thing and certainly don't
know it by heart so I can't say what part the OP is talking about.
Yes, you can do it, but it's ghastly. To support 0..N arguments you have
to write N+1 templates. Which is why C++0x will probably have
variable-length argument lists for templates.
--
-- Pete
Roundhouse Consulting, Ltd. ( www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." ( www.petebecker.com/tr1book)
Pete Becker wrote:
Noah Roberts wrote:
However, in practice this type of template can be created for some
upper number of N. Look at many examples from TR1 and Boost (tuple,
MPL, array, etc...). I'd be surprised if that book doesn't describe
these techneques but I haven't read the whole thing and certainly don't
know it by heart so I can't say what part the OP is talking about.
Yes, you can do it, but it's ghastly. To support 0..N arguments you have
to write N+1 templates. Which is why C++0x will probably have
variable-length argument lists for templates.
>From what I've seen it's more like N/X with X default parameters. For
instance, mpl's vector is implemented in terms of a vector10, vector20,
vector30...whic h have 10, 20, and 30 default parameters.
Noah Roberts wrote:
dasjotre wrote:
Fan Yang wrote:
I'm reading Modern C++ Design, and it is saying "Variable template
parameters simply don't exist."
aka variadic template parameters
But I find VC7.1 & VC8 support this feature.Who can tell me that which is
right -_-b
I am not aware of any compiler supporting variadic template parameters.
However, in practice this type of template can be created for some
upper number of N. Look at many examples from TR1 and Boost (tuple,
MPL, array, etc...). I'd be surprised if that book doesn't describe
these techneques but I haven't read the whole thing and certainly don't
know it by heart so I can't say what part the OP is talking about.
In 'Modern C++ Design', he uses that technique to design type lists
and function wrappers. It is tedious and best done with something like
m4 or boost::preproce ssor. Than again, having type lists, I see no
reason why you couldn't use them to emulate variadic template
parameters, up to the maximum length of the type lists.
But that is not a true variadic template like the ones you have in D.
Noah Roberts wrote:
Pete Becker wrote:
>Noah Roberts wrote:
>>However, in practice this type of template can be created for some upper number of N. Look at many examples from TR1 and Boost (tuple, MPL, array, etc...). I'd be surprised if that book doesn't describe these techneques but I haven't read the whole thing and certainly don't know it by heart so I can't say what part the OP is talking about.
Yes, you can do it, but it's ghastly. To support 0..N arguments you have to write N+1 templates. Which is why C++0x will probably have variable-length argument lists for templates.
>>From what I've seen it's more like N/X with X default parameters. For
instance, mpl's vector is implemented in terms of a vector10, vector20,
vector30...whic h have 10, 20, and 30 default parameters.
I haven't looked at the details there, but from a glance it seems like
that's just part of a divide and conquer approach for the preprocessor,
where each of those templates in turn generates 10 template classes.
Sooner or later you have to decide which template arguments are real and
which ones aren't.
Of course, any program that needs to pass more than ten template
arguments is out of control. <g>
--
-- Pete
Roundhouse Consulting, Ltd. ( www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." ( www.petebecker.com/tr1book)
Pete Becker wrote:
I haven't looked at the details there, but from a glance it seems like
that's just part of a divide and conquer approach for the preprocessor,
where each of those templates in turn generates 10 template classes.
Possible, but it would be surprising. Compiler output from errors
indicate the final types contain the default values; at least when
using MPL vector. But I haven't done a lot of looking either.
>
Sooner or later you have to decide which template arguments are real and
which ones aren't.
Of course, any program that needs to pass more than ten template
arguments is out of control. <g>
Well, the basic dimensional analysis idiom requires something like 8 or
9 so more than 10 isn't really outside reason in metaprogramming . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Karsten Weinert |
last post by:
Hi!
Can you please explain to me the difference between a xsl:param and a
xsl:variable? Since I can assign a value to both only once, what's the
point? A small example would help me a lot.
Regards,
Karsten.
--
The email above is not in use. Please write to k dot weinert at gmx
dot net.
|
by: Saqib Ali |
last post by:
Please excuse me, this is a fairly involved question that will likely
require you to save the file below to a file and open it in a browser.
I use Mozilla 1.5, so the problem I describe below should be
reproducible with that version at least.
BACKGROUND:
===========
When you open this page in your browser, you will see a 4 cell table....
|
by: martin.druon |
last post by:
Hi,
I created a template class to represent hypermatrix. I would like to
add methods where the number of parameters are checked during the
compilation time. For example :
template <size_t dim>
class Matrix
{
protected :
|
by: rincewind |
last post by:
Hi,
can anybody summarise all options for partial template specialization,
for all kind of parameters (type, nontype, template)?
I *think* I understand options for partial specialization on type
parameters - in place of a template argument one can construct arbitrary
valid C++ type declaration, more or less like in "typedef" statement.
...
|
by: John Shell |
last post by:
Hello, all.
The following code results in a C2666 error (2 overloads have similar
conversions).
class FSVec2D
{
public:
FSVec2D()
{ // code omitted
}
| |
by: Zytan |
last post by:
I see that static is more restricted in C# than in C++. It appears
usable only on classes and methods, and data members, but cannot be
created within a method itself. Surely this is possible in C# in some
way? Or maybe no, because it is similar to a global variable (with its
scope restricted) which C# is dead against?
Zytan
|
by: Orin |
last post by:
Hi,
Here is my task:
- need to get text from a template variable.
For example we have a text with templates "Cars" and "Producers":
"{{Cars|Toyota=blablabla |Moskvitch=blablabla |BMW=blabla ...}}
{{Producers|TableLTD=blablabla |PhoneINC=Developed in 1998 in Kiev,
|
by: Pierre Yves |
last post by:
Hi there,
Sorry for the double subject but I feel they are related. I'm not pretty
sure there would be an answer but I reckon there must be a way to make
it work.
I would like to write the following bit of code:
8<----------------------------
|
by: Stephen Horne |
last post by:
I've been using Visual C++ 2003 for some time, and recently started
working on making my code compile in GCC and MinGW. I hit on lots of
unexpected problems which boil down to the same template issue. A
noddy mixin layer example should illustrate the issue...
class Base
{
protected:
int m_Field;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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: 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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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.
| |