Type: Posts; User: monarch_dodra
Search took 0.11 seconds.
April 16th, 2015, 04:08 AM
As a rule of thumb, prefer using "vector::data()" than "&vector": It is more idiomatic in the sense that you use a function specifically designed explicitly for this use case. More importantly...
April 16th, 2015, 03:54 AM
I usually just use tinyxml (http://www.grinninglizard.com/tinyxml/). It is a very lightweight, easy to install and very simple to use. It doesn't have a ton of features: you just give it an xml...
April 11th, 2015, 04:47 PM
Do yourself a favor and Learn to use a debugger. The debugger would have told you that faster than it took you to copy paste your code here.
March 30th, 2015, 02:29 PM
Pretty sure that "If I run the same program twice under linux", then nothing will be shared in memory.
March 27th, 2015, 08:34 AM
These are good reading, but (IMO), both fail to recognize that having (certain) functions as members is simply convenient from a user's point of view. Just because you can, doesn't always mean you...
March 27th, 2015, 08:23 AM
For operator=, checking for that this and the right hand side are the same is usually a good idea. But if you can write your code in such a way that it does not matter, that's equally good. Also, for...
March 25th, 2015, 10:05 AM
This should be pretty trivial. Just make them return a reference "vmSize&", and at the end of your function, return a reference to this "return *this". That's really all there is to it:
March 25th, 2015, 05:07 AM
The usual standard practice is to make binary operators non-member fields. In this case it does no change much (if at all), just know this exists.
Also, from a style point of view, in C++ the...
March 25th, 2015, 04:37 AM
I have to disagree with this answer. The memory block itself is assigned to msg, and valid (though its contents are rubish, yes).
Even then, string has a constructor that takes a buffer, and a...
March 16th, 2015, 03:50 PM
The design of your sum is wrong. It should return a new fraction "Fraction sum(Fraction a, Fraction b)", and then you want to print *that*. For example:
Fraction c =...
March 10th, 2015, 09:55 AM
I mean that C has a "ready to use" global PRNG that you only need to seed once for the global application. C++11 has a lot of PRNG *types* but no global PRNG for sharing.
That is a good...
March 10th, 2015, 03:55 AM
I was wondering if there was a recommendation in regards to seeding C++11 randoms.
The thing is that C-rand can be seeded with time, as it is a global random that only gets seeded once (though...
March 9th, 2015, 12:09 PM
Honestly, no. Please ask a clear question, so that we can provide a clear answer.
You mentioned insertAsFirstElement so I will take a look at that.
Also, please put your code in
March 5th, 2015, 09:15 PM
The fact that it is called "C, C++ tutorial" is already a telltale sign...
March 3rd, 2015, 12:18 PM
Yeah, the take home point here is that "" is a bad idea. "(x, y)" (or "get(x ,y)" if you don't like operator()) is the way to go.
An argument in favour of "" is that it could return an...
February 21st, 2015, 02:05 PM
If your error is "Error 127 - Process not found", the it is not a C++ problem, but an environment/program problem. There is absolutely nothing wrong with your program, which should work as-is....
February 20th, 2015, 09:19 AM
Actually, we should now prefer uniform initialization, and possibly, the "almost always auto" anitialization.
February 13th, 2015, 09:42 AM
Yes, it did not disprove the UB. It did disprove the "If you do it anyways, it terminates". Which was kind of my point that both statements are contradictory (you can't have UB if the standard...
February 13th, 2015, 07:41 AM
Wait what? since when? That's news to me. Are you sure about this? AFAIK, you just *shouldn't* throw exceptions in destructors. Do you have any references for that?
If you do it anyway, and it...
February 9th, 2015, 03:41 AM
Agreed. But when all that is said and done, dynamic_cast is usually frowned upon and a good sign of code smell. As for private inheritance, while I understand the concept and use-case, I have NEVER...
February 6th, 2015, 04:30 PM
It doesn't really "work". It just appears to work. The cast is illegal, and you are in undefined behavior.
The reason you *think* it works is because dif was *not* declared virtual, and as such...
February 6th, 2015, 05:21 AM
I'm not sure what you mean by "recursively incomplete". The issue is rather that you will have multiple definition issues (since you are redefining it on a "per template instance" basis). As (kinda)...
February 4th, 2015, 09:22 AM
This thread is so ridiculously off topic (and against TOS), that I don't know why any of us are still replying. Not only that, the actual question itself is vague beyond the possibility of any...
January 30th, 2015, 09:37 AM
My first google result for "mime case sensitive" (http://stackoverflow.com/questions/12869278/are-mimetypes-lowercase-case-insensitive) seems to indicate that RFC 2045 states that (quoting quote from...
January 23rd, 2015, 11:17 AM
Be careful. This is probably not what you wanted. I believe what you wanted here was to do a "specialization"? This is not what you did. What you did was declare a template parameterized on *a*...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.