Type: Posts; User: Graham
Search took 0.11 seconds.
October 16th, 2009, 06:14 PM
Thanks for the responses, everyone.
Maybe one day I'll feel ready (or need :) ) to take on part time or short term contracts. If so, I'll be back, but for now let me say how much I've enjoyed...
October 15th, 2009, 05:09 PM
Apologies for starting an off-topic thread here...
Some of you may have noticed that I haven't been around this forum for several months, now. The fact is that I was made redundant from my job at...
January 22nd, 2009, 06:03 AM
Abstraction is the idea that the class works in the way you want it to work. Encapsulation hides all the nasty translation of that abstraction into the bits you have to use to do it.
January 22nd, 2009, 06:00 AM
AFAIAA, that technique won't work with a template, since you can't have template friends, so each "finaliser" has to be specific to the class it's finalising.
January 21st, 2009, 05:12 AM
Without getting into the question of whether NVI should be enforced or not, I still tend to stick to one of my basic dicta, which is: "you need a reason to make something non-private".
So, if I...
January 20th, 2009, 11:36 AM
If it isn't, they'll have to start calling it "C++1x".
January 20th, 2009, 06:32 AM
Because the implicit "this" pointer within foo::bar would be null and any attempt to access a member would imply dereferencing a null pointer, which is undefined behaviour.
January 14th, 2009, 11:48 AM
January 14th, 2009, 04:15 AM
Possibly it simply means that there are no "signed/unsigned" variants of the type. As in, you can't have "unsigned float" as a type.
January 12th, 2009, 04:20 PM
Nope. Memberwise copies. For members of class type, it will call the appropriate copy constructor, for members of basic type (int, pointer, etc.) it's likely to be bitwise, but it's better to think...
January 12th, 2009, 09:51 AM
Interesting - Comeau fails it with the same errors. Presumably implicit default ctors are not considered wrt const objects. I'll see if I can find the relevant section of the standard.
January 12th, 2009, 09:43 AM
It's the version number I was after (I somehow managed to completely omit the word "version" from the question).
Are you sure that what you posted is the entire code that generated the error?
January 12th, 2009, 08:32 AM
Which compiler are you using? That shouldn't make any difference because your class will have a default ctor provided for it by the compiler.
January 12th, 2009, 08:30 AM
D is correct because catching by value may invoke a copy constructor, and that could throw an exception itself, leading to a call to terminate().
January 12th, 2009, 06:11 AM
January 8th, 2009, 04:04 PM
You can't pass a type as an actual argument, you can only pass an object of a given type.
No, a reference to an object of that type is given to the function as a parameter.
January 8th, 2009, 07:44 AM
random_shuffle() needs a random access iterator...
January 7th, 2009, 06:29 PM
Emphasis on the may. And, yes, I could see it as a possibility - after all, they can unroll loops if it's more efficient. Don't forget, optimisers have access to compiler implementation details that...
January 7th, 2009, 11:19 AM
...until a day or two after this assumption gets deeply embedded into the code, at which point the requirements will change in such a way as to make the assumption invalid.
January 7th, 2009, 11:15 AM
Don't forget that the optimiser may well hoist the declaration out of the loop for you (and in a more efficient way than you could achieve manually), so the point could well be moot.
January 7th, 2009, 04:52 AM
Switching debug on frequently de-inlines functions. The compiler often ignores "inline" on large functions, or for any of a number of reasons.
It won't break the code, since the compiler knows...
January 6th, 2009, 04:40 AM
The only way you're going to get a definitive answer is to put together a test harness and time the two approaches. Never try to second-guess such fine differences.
January 5th, 2009, 02:19 PM
Hang on, that doesn't do what the original post was trying to achieve. In the OP, you had policy defining a type declared within the template argument
January 1st, 2009, 05:17 AM
IIRC, the worst case in UTF8 encoding is that a particular character can require 6 bytes in UTF8.
Looking at it pragmatically (and assuming that you're using C++), I would tackle the problem by...
December 23rd, 2008, 02:35 PM
I did note the namespace issue...
But there is the possibility of confusion by using the same name, and it only takes one pillock to put "using namespace std" in a header file...
Click Here to Expand Forum to Full Width