Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums


Type: Posts; User: jwbarton

Page 1 of 11 1 2 3 4

Search: Search took 0.01 seconds.

  1. Re: Destroying an CArray of Cobject derived classes.

    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...
  2. Re: 'this' pointer corruption or am I fooling myself ?

    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.

    class A
    virtual ~A()
  3. Re: conditional breakpoint with string does not work in visual studio 2010 as I expec

    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...
  4. Re: conditional breakpoint with string does not work in visual studio 2010 as I expec

    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...
  5. Replies

    Re: boost::shared_ptr with std::vector

    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...
  6. Replies

    Re: valarray and math.h

    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...
  7. Replies

    Re: How to use #define _CRT_SECURE_NO_DEPRECATE?

    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...
  8. Replies

    Re: CArray vs. std::vector

    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...
  9. Replies

    Re: CArray vs. std::vector

    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).

    Best regards,
  10. Replies

    Re: Changing function based on a condition?

    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).

  11. Replies

    Re: Detecting memory leaks (VC8)

    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...
  12. Replies

    Re: Multiple virtuality

    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:

    #include <iostream>

    using namespace std;
  13. Replies

    Re: I need help with STL: vector

    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...
  14. Replies

    Re: I need help with STL: vector

    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...
  15. Re: print out command that entered

    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().
  16. Replies

    Re: Remove Vector Element

    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...
  17. Re: Problems designing my vectorized math library

    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...
  18. Re: Problems designing my vectorized math library

    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...
  19. Re: Problems designing my vectorized math library

    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)
  20. Re: Problems designing my vectorized math library

    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...
  21. Replies

    Re: Member function as function argument

    Hi Johnny,

    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...
  22. Replies

    Re: Member function as function argument

    The easiest way is to just make a new member function of the Model:

    // needed include file:
    #include <cmath> // or <math.h>
  23. Replies

    Re: Member function as function argument

    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...
  24. Replies

    Re: First foray into libboost

    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...
  25. Replies

    Re: member binary predicate problems!

    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....
Results 1 to 25 of 253
Page 1 of 11 1 2 3 4

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


HTML5 Development Center