wow, that's a clever implementation. Thank you. But it's too complicated for a simple implementation that I'm looking for. I will just skip C arrays since I will probably never use them directly...
Type: Posts; User: plutino
wow, that's a clever implementation. Thank you. But it's too complicated for a simple implementation that I'm looking for. I will just skip C arrays since I will probably never use them directly...
Thanks for the clarifications, especially on C++ array definition. These functions are used by a Debug class to dump random user data into a file stream.
This sounds like a dead end. I'm trying to plug this debug class in a old code set. Most part of the code has already used a stripped-down version of the vector class, but some older parts still...
By the way, is there a better way to handle the variable arguments function reloading than the pyramid I used? I don't want to go with the old C va_list method.
Well, these "arrays" are dynamically allocated with "new double[]". their sizes are not going to change once allocated. Maybe I should go with a non-uniform argument list, say, move the "int...
Sorry about the confusion. I don't process any single pointers, only need to overload it to work with arrays. I haven't thought about a class implementation, but these functions are already class...
Thanks. Multiple instantiation is not an issue, since these are all two-statement inline functions. However, the problem is that I don't know the array size ahead of time. If I change your...
You are right. I guess the only benefit (depending on your point of view) is to make the code more compact.
I think there are some cases that benefit from returning a reference. For example, I have a function to convert something to a string, and use the converted string in a string expression. I can...
I guess that the warning is about returning a reference to a local variable. It has nothing to do with template. When you return a reference from a function, make sure the variable is still alive...
I need to overload a function template so that it can handle between 1 to 6 arbitrary arguments. So I have these declarations:
template<typename T>
void f(int verbose, const T&);
...
my bad. Just realized the code in question is not a template header.
That's just for example. The real case is that the function is a template.
a.hh:
template <typename T> T func(T i){ ... }
Assume that two pieces of code use the same tempolate header. If the two pieces are compiled separately and linked together. Then there might be a duplicated definition error. How to avoid this...