Type: Posts; User:
April 25th, 2013
Interesting. Good point.
Ah... Now THERE is a good solution... Unfortunately, I gave you a reduced use case. Inside actual code, the "-" is (potentially) at call site:
April 24th, 2013
I'm porting a macro from VS to GCC. The macro is pretty trivial: Take A and B, and create "A-B":
#define QUOTE1(A) #A
#define QUOTE2(A, B) QUOTE1(A##-##B)
March 18th, 2013
That'd be my "go to" solution, if it was legal C++.
error: a storage class can only be specified for objects and functions
VStudio compiles, but emits:
warning C4091: 'static ' :...
March 15th, 2013
March 15th, 2013
Hi all (long time no see)
I've been wondering about something for a while:
Is it possible to declare a struct/class, in a cpp file, designed for local use, but with internal linkage?
January 24th, 2013
You could try the "update the return value as you go" scheme:
ReturnType return_val = a;
return_val = b;
November 23rd, 2012
I wanted to add to always, always, be very very careful with values "that can only hold two states". Unless your variable actually holds a representation of "true/false", more often that not, it ends...
August 23rd, 2012
"app (append) : Set the stream's position indicator to the end of the stream before each output operation."
You want ate:
August 20th, 2012
In this case "MyConst" will probably get inlined anyways, but imagining that MyConst was complex, then the usual method is to create a "non template X" where x is one of:
August 20th, 2012
Your logic is wrong. I agree with 1 and 2, but 3 is in direct conflict with 2.
By making all your methods virtual, you are allowing users to "hijack" them by over-riding them. Once you have...
"in the 2nd case the value of the char dlm will be set only when the if statement holds true".
"otherwise it should be undefined": "undefined" is not a special spectral value that crashes a...
I wish, but this current project has the following restraints:
1) No templates due to compiler limitations.
2) No non in-house code.
EDIT: 3) No exceptions.
It's basically "C with classes...
Move it is then!
I am writing a little OS agnostic library for my team for manipulating files.
One such function is used to move/rename files (only files, not dirs). I got into a little argument with a colleague...
Rule of thumb:
*If it starts with an underscore, then it is not standard.
*If it starts with 2 underscores, then it is not standard, and compiler specific.
If they are templates, then everything goes into .h files. There will be no .cpp file, unless you have parts that don't depend on a parametrized type.
The standard thing to do is usually to put...
To give you a quick answer: Yes, but it is complicated. You want to search for either "traits" (general solution), or, in your particular case: SFINAE.
Toying with the allocator would only defer the problem to later, once you are handling strings with incompatible allocator types.
As laserlight said, why not just declare your objects as...
Interchanging iterators creates undefined behavior, simple as that. What's to keep you from checking during debug that the iterators came from the same object? All you need is to keep a pointer to...
Nobody in their right mind would write code like this. Besides, standard containers would have exactly the same problem.
Just FYI, what you want is not strictly a container since the object does...
There are many different files that are involved in the construction of a final product, your "main.exe", or whatever your project is called. That's the only file AVG is having problems with, and the...
I don't see why you'd want a singleton here. The question should never be "can it be a singleton" but "does it have to be a singleton".
The answer to both is no anyways. For example, if your rom...
Why don't you just add your program to the safe list? The safe list is designed for these kinds of situations.
It happens sometimes when you write very simple programs. It is just a false positive from your anti virus program: Usually, just touching anything in your source and recompiling is enough.
Click Here to Expand Forum to Full Width