Type: Posts; User: jwbarton
Search took 0.02 seconds.
November 22nd, 2013, 03:39 PM
Deriving an class from CObject and then using it in a CArray directly (not as a pointer) requires additional work to be done in the class.
The CObject class declares a private copy constructor and a...
November 4th, 2013, 07:27 AM
I can't get it to happen with the example that you posted.
One situation that can cause this to happen is if the classes use virtual inheritance.
October 30th, 2013, 04:04 PM
Unless you are intending to build your program both for Unicode and for single/multi-byte, the use of the various _T macros and _t functions just complicates the program. I don't use them with my...
October 30th, 2013, 01:55 PM
The debugger doesn't make it easy to use inline members of classes in conditional expressions.
However, you can help it by adding extra code.
For example, you can create a local variable which...
August 14th, 2012, 03:11 PM
Looking at your first post, I can see a problem with your use of shared_ptr.
A shared_ptr will delete the object once the last shared_ptr that points to an object goes out of scope. Since you are...
March 30th, 2011, 07:54 AM
Check if you are including math.h inside of stdafx.h.
If you are, you need to put the #define inside of stdafx.h, before including math.h. Otherwise any include of math.h after stdafx.h is...
March 7th, 2011, 09:25 AM
Yes, this is one of the correct ways to handle this.
When using precompiled headers with the Microsoft compiler, it ignores any code in the source file until it finds the include of the...
March 7th, 2011, 09:11 AM
Using std::string instead of CString with the VS2010 compiler can produce faster results without needing to rely on tricks (treating the CString as a POD).
The std::string object in VS2010...
March 4th, 2011, 02:02 PM
This has been fixed in Visual Studio 2010 - the default for debug mode is still to have checked iterators, but release mode has _SECURE_SCL set to 0 (at least by default).
February 23rd, 2011, 09:44 AM
I think to get the same meaning as the original, better style would be
bool valid = false;
while (! valid)
(and then set valid = true in when the string entered is valid).
February 10th, 2011, 12:35 PM
This most likely isn't reporting a leak due to the small string optimization that is done with std::string.
Basically, for strings with 15 characters or less, the data for the string is held...
February 10th, 2011, 08:39 AM
You can achieve this by using a double dispatch, which is often achieved using the Visitor pattern.
One way of implementing this is as follows:
using namespace std;
February 9th, 2011, 09:03 AM
I too wouldn't recommend using this, but anyone using STL should still be aware of how it works.
There are guarantees provided by the standard for each container which specify exactly how and when...
February 9th, 2011, 07:55 AM
An erase() on a vector will only invalidate elements after the erase location - iterators to elements before the erase location remain valid.
An insert() on a vector will only invalidate elements...
February 8th, 2011, 12:55 PM
This isn't necessarily true. When running on Windows, the command line is parsed by the startup code of the executable. This is parsed into the familiar argc/argv before the runtime calls main().
January 25th, 2011, 01:46 PM
The behavior you observed is normal.
When you use remove_if(), the vector is modified by shifting any elements which don't match the predicate up (any which SomeFunc() returns false). The...
November 11th, 2010, 01:56 PM
While conceptually this is true, in practice it depends on the compiler implementation. It is true that the computed result of using a non-member operator with __m128 is the same as making a class...
November 10th, 2010, 03:01 PM
I am not the original poster. I was just curious what the reasons were for the performance problems reported by the original poster.
My idea was to try to provide the original poster with the...
November 10th, 2010, 02:48 PM
I stand corrected.
I had the syntax wrong and the compiler error I got didn't help.
Is this correct?
__m128& operator+=(__m128& a, __m128 b)
November 10th, 2010, 01:11 PM
I took a quick look at the code generation for an intrinsic __m128 using direct calls to _mm_add_ps() to add the 4 floats, and then the member routine in your float4 class which also calls...
November 2nd, 2010, 02:35 PM
When I provided the original solution, I was just going for a quick and dirty solution.
There is a solution which doesn't require writing the BoundModelFunc adaptor (assuming that it...
November 2nd, 2010, 07:58 AM
The easiest way is to just make a new member function of the Model:
// needed include file:
#include <cmath> // or <math.h>
November 1st, 2010, 10:12 AM
Your problem is that you can't pass a pointer to a member function to a routine that expects a pointer to a normal function.
You need to provide an adaptor that will make bind the model object...
December 7th, 2009, 10:37 AM
I have used boost a bit, but I avoided any part which required a separate library (such as the regex support).
If the compiler you are using has a tr1 implementation, you may want to use the...
November 11th, 2009, 10:10 AM
You probably don't want to make the functor a static variable. It would then only be initialized the first time that Map::GetSeed is called. This would be bad if you have more than one Map object....
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.