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

Search:

Type: Posts; User: monarch_dodra

Page 1 of 80 1 2 3 4

Search: Search took 0.07 seconds.

  1. Re: overriding == operator in order to test equality of two pointers

    Not sure what that means. But your code seems code but it doesn't show everything. It *should* word.

    BTW, what you are comparing here is not actually pointers, so you could just define a global...
  2. Replies
    32
    Views
    1,280

    Re: stl map of vectors

    I think people who can't recognize they are fallible are the ones that shouldn't be programmers.
  3. Replies
    32
    Views
    1,280

    Re: stl map of vectors

    You are using a C++11 range based for loop which is good, but for some reason, you decided to manually write a second (nested) loop instead of using simply using std::find.

    While not a mistake in...
  4. Replies
    32
    Views
    1,280

    Re: stl map of vectors

    It really depends. Just make sure your loops are not too convoluted. *Personally*, I hate having variables such as "done" or "found". It bloats the code with later tests. I think a good break, return...
  5. Replies
    32
    Views
    1,280

    Re: stl map of vectors

    You forgot to incrment your iterator I believe. Try this:


    string sPDN;
    // If there is a default bearer, then only send a request to PCRF.
    for (; iIter != CPCRF::m_mPDN2RxSessionIds.end();...
  6. Replies
    32
    Views
    1,280

    Re: stl map of vectors

    As answered by laserlight, with what you currently have, you have no choice other than to simply iterate your map, and search each vector individually. Searching the vectors individually can be done...
  7. Re: Accepting a value by reference upon return

    [QUOTE=lucky6969b;2184855]

    A& n = (A&)*it;


    I don't know why this cast is needed here, but for me, it is a *massive* red flag.

    As for the initial question, if B gets destroyed and holds...
  8. Replies
    1
    Views
    232

    Re: Read class objects into array?

    The issue is not how you allocate, but rather, you you are calling the functions. twoday is an array of 100 pointers. so "twoday.calculateShippingCost" does not make sense. You need to make it...
  9. Re: Creating a text file for randomly generated numbers

    Please don't necro an old thread when you don't really have anything new to contribute, just to link to your blog.
  10. Re: Codeguru needs a C++ programmer to write

    Is the point here just to promote (advertise?) a third party tool? I'm all for static code analysis, but I also feel that the answer should promote modern approaches and best practices that would...
  11. Re: Recursive function: take a non-negative integer and print each digit of that inte

    I think the original argument is that some problems really call for recursive solutions (for example, anything that has to do with a tree), whereas others do not (printing a number). When you want to...
  12. Re: Find all sentences or consecutive sequence of sentences where min

    Arguably, that's the biggest mistake you could make.

    A rule of thumb is to never rush, no matter what. Understand the problem to the best of your abilities. If there are still points you are not...
  13. Re: Is memory allocated to a variable name or an address?

    I assume that by "memory allocation in code" you mean "new" ?

    New makes an allocation, and then returns the address of the allocated space (if successful) in the form of a pointer. It is then up...
  14. Replies
    7
    Views
    806

    Re: stl map with two keys

    "Invalid Iterator" might be a missleading message here. Or at least. Not very helpful. It is only a consequence of the fact that key you are looking for is missing. So "Key not found in...
  15. Re: How to make a std::map return null when there is nothing "at" a certain position?

    The advantage here is simply locality. You avoid poluting your namespace/class with single use helpers. Furthermore, when using said helper, you don't need to look very far to find its definition.
    ...
  16. Replies
    6
    Views
    496

    Re: Hexagon Grid

    It really depends on how you define your grid. Do you move *along* the edges of your hexagons? Or are the hexagons themselves simply cells, and you can move in any 6 directions.

    AFAIK, you can't...
  17. Re: How to make a std::map return null when there is nothing "at" a certain position?

    Fine: "And I most certainly would NOT use at if I plan to IMMEDIATELY handle it." (https://isocpp.org/wiki/faq/exceptions#too-many-trycatch-blocks)
  18. Re: How to make a std::map return null when there is nothing "at" a certain position?

    I'd go for either:


    auto it = unitColors.find(unit->id);
    auto color = it != unitColors.end() : *it ? DWord{0};



    auto color = DWORD{0};
    if (unitColors.find(unit->id) != unitColors.end())
  19. Replies
    17
    Views
    1,415

    Re: Sorted vector/list to set

    Actually, I wasn't too worried about subsequent lookup/insertion, as I knew that the container is guaranteed balanced and has log(n) guaranteed performance. I was actually worried that the initial...
  20. Replies
    17
    Views
    1,415

    Re: Sorted vector/list to set

    Hi, I'm necro-ing this 6 year old thread. I stumbled upon it while searching for something else, and decided to follow up on this, as I found interesting information.

    So I actually benchmarked...
  21. Re: error: expression must have a class type

    As a rule of thumb, prefer using "vector::data()" than "&vector[0]": It is more idiomatic in the sense that you use a function specifically designed explicitly for this use case. More importantly...
  22. Replies
    49
    Views
    1,955

    Re: .xml to .txt

    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...
  23. Re: Dequeuing Integer Values From Heap Results In Garbage Values

    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.
  24. Re: If I run the same program twice under linux

    Pretty sure that "If I run the same program twice under linux", then nothing will be shared in memory.
  25. Re: Basic operator overloading

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