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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.14 seconds.

  1. Replies
    1
    Views
    111

    Re: phone number validation and looping

    I suggest that you separate this function into two functions:

    bool checkValidPhoneNumber(const std::string& phoneNumber);
    void readPhoneNumber(std::string& phoneNumber);
    You would place all the...
  2. Replies
    3
    Views
    77

    Re: Assignment operator question

    You observed the effects of the comma operator. That is, the comma operator has a lower precedence than the copy assignment operator, so this:

    lLag1 = 5, 6;
    is equivalent to:

    (lLag1 = 5), 6;...
  3. Re: overriding == operator in order to test equality of two pointers

    Since you chose to overload operator< for AStarNodePair, you no longer need AStarNodePairComparator. However, I notice that you suddenly switched to std::set.
  4. Replies
    3
    Views
    204

    Re: (Begginer) problem with sum c++

    So, what is the problem that you're having with the sum?
  5. Re: overriding == operator in order to test equality of two pointers

    You cannot overload operator< with both parameters of pointer type though, hence my suggestion of a named function or function object to serve as the comparator.
  6. Thread: Error C3861

    by laserlight
    Replies
    1
    Views
    141

    Re: Error C3861

    Reading MSDN on TryEnterCriticalSection, perhaps the appropriate header was not included.
  7. Re: overriding == operator in order to test equality of two pointers

    Because you overloaded operator< such that a AStarNodePair object is expected on the left hand side but a AStarNodePair pointer is expected on the right hand side. This is consequence of overloading...
  8. Re: overriding == operator in order to test equality of two pointers

    What is the exact type of the std::map?


    You meant overload, not override. The term override is used specifically when you want to override a virtual function. Anyway, std::map uses operator< by...
  9. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    I see. Thanks!


    Yeah, I recall reading Stepanov, if I remember correctly, arguing that ranges would be superior to explicit iterator pairs, but I was unaware that such a proposal might actually...
  10. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    That looks good. Could you link to the relevant proposal?
  11. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    That's a good point: part of readability depends on the reader's familiarity with the paradigms in use. Yet, C++ is multiparadigm, so I do not see a problem with mixing and matching, hence I disagree...
  12. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    No, my post #16 is a reply to your post #18. That is why I found it strange, but yeah, "posted then deleted" does explain it. Talk about concurrency :D

    Anyway, to address your additional points:
    ...
  13. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    Weird, did the posts go out of sync? I was fairly certain that I was replying to tiliavirga's post, but it looks like my post now appears before the post that I was responding to.
  14. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    I don't quite understand what you mean by "structure over logic" here though: isn't the structure entirely a logical structure?

    One advantage of using the generic algorithm is that the abstraction...
  15. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    In themselves, nothing, except that in this case the std::find generic algorithm expresses the intent more clearly with a name and removes the need to break out of nested loops with a goto as the...
  16. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    Aye, it looks like a strange decision to me, especially since it would eliminate the need for a goto to break out of the nested loops. Besides, I get the impression that bFound exists solely to...
  17. Replies
    7
    Views
    3,500

    Re: vectors of vectors of different types...

    The problem is that you have a vector of pointers to Value. The Value class does not have a member named value. Hence, you need to cast the pointer to Value to be a pointer to whatever derived class...
  18. Re: Store subclasses of objects in a vector

    Why do you want to do this? If Object were a polymorphic base class, you could use dynamic_cast to achieve this, but it would be better if you declared a virtual function in the base class that each...
  19. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    std::find would suffice, and I think that it would be appropriate:

    const std::vector<string>& strvec = iIter->second;
    if (std::find(strvec.begin(), strvec.end(), sSessionId) != strvec.end())
    {
    ...
  20. Replies
    32
    Views
    1,189

    Re: stl map of vectors

    The map only maps one way, so you have to go over the mapped values (i.e., the vectors) and search each vector to find the given Rx session Id.
  21. Replies
    9
    Views
    418

    Re: My problem with pointers

    Well, that is what namespaces are for, though I am not sure if strdup would also be in the std namespace since being POSIX standard only it is not part of the standard library, and besides there is...
  22. Replies
    9
    Views
    418

    Re: My problem with pointers

    Especially since there is a POSIX standard function named strdup which has the same parameter list and return type, and which does obtain storage using malloc.
  23. Replies
    9
    Views
    418

    Re: My problem with pointers

    You duplicated a null terminated string but forgot to null terminate your duplicate, and in fact you did not even allocate enough space for the null character (having hard coded 4 instead of using...
  24. Re: Accepting a value by reference upon return

    Obviously, you can keep an array (or vector) sorted. The problem (and this is a general algorithm and data structure problem, not one limited to C++) is that an insertion into the middle of an...
  25. Re: Pass reference to string as default parameter

    As in with pass by value or with a const lvalue reference parameter?
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!


HTML5 Development Center