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

Search:

Type: Posts; User: razzle

Page 1 of 25 1 2 3 4

Search: Search took 0.03 seconds.

  1. Thread: Integer Range

    by razzle
    Replies
    16
    Views
    519

    Re: (Resolved) Integer Range

    Dear quorsum,

    On behalf of the rest of us I would like to extend an appology. Despite our sincere efforts our replies must have blocked your thinking and so of course we don't deserve even a thank...
  2. Re: Just wondering what the equivalence of this method is for C++?

    Well, the OP wanted equivalence and returning f is closer to the original.



    I agree it may be safer to rule out NaN first and since the order doesn't matter logically I change my suggestion...
  3. Re: Just wondering what the equivalence of this method is for C++?

    The Java function can be used pretty much as written. Here's a C++ 11 template version to handle both float and double:



    #include <cmath>

    template<typename T>
    T signum(T f) {
    return...
  4. Re: Just wondering what the equivalence of this method is for C++?

    I think "return 0.0;" should rather be "return f;" to conform with the original.



    But std::isnan in <cmath> is overloaded both for float and double.



    Why is that? For an || logical...
  5. Replies
    9
    Views
    318

    Re: Problem with empty/null string/char...

    Only you know since you're not telling how you compare.

    Have you printed what file_name points at so you know it is '\0' indeed?

    Are you sure you are comparing what file_name points at and not...
  6. Re: How to get the address of 1st node in

    The STL containers don't give you access to implementation detail like say internal pointers.

    What you could do is push the elements on stack, clear the list, and then rebuild it with the elements...
  7. Re: How to make a std::map return null when there is nothing "at" a certain position?

    Locality? It beats me why you consider this,



    void foo() {
    auto unitColors_at_or_zero = [&]( auto id ){ auto it = unitColors.find(id); return it != unitColors.end() ? *it : 0; };
    DWORD...
  8. Thread: Integer Range

    by razzle
    Replies
    16
    Views
    519

    Re: Integer Range

    That works for me too. :)

    But there's a certain amount of implementation dependency at play here and it's never wrong to be explicit about the literal type.

    Also it seems in C++ 11 it's...
  9. Thread: 3d vector

    by razzle
    Replies
    4
    Views
    208

    Re: 3d vector

    You don't have to do anything special. You can treat it like you would an int or double.
  10. Thread: Integer Range

    by razzle
    Replies
    16
    Views
    519

    Re: Integer Range

    To denote a long long literal you need to add one of the suffixes l or L like

    long long test = 5000000000L;
  11. Re: How to make a std::map return null when there is nothing "at" a certain position?

    That's typical feature overuse. Something a pumped up newbie would put in to show off. You get the worst of two worlds:

    As implementation it's too much. What's wrong with a simple free function? ...
  12. Re: How to make a std::map return null when there is nothing "at" a certain position?

    Certainly (as all replies show) but regardless of how you decide to do it I suggest you encapsulate the map, the initialization of the map and accesses to the map in a class called say UnitColors...
  13. Re: What is the best matching data structure for C# binary heaps in C++ with boost?

    As an abstract data type a heap is called a priority queue so that's what you should be looking for.

    The C++ standard library has one called std:: priority_queue and I'm quite certain there is one...
  14. Replies
    6
    Views
    416

    Re: Increment or double problem

    Recursive problem formulations are often succinct and elegant but they have their fair share of problems in practice. One is the risk of running out of stack space, another is the relative slowness...
  15. Replies
    6
    Views
    416

    Re: Increment or double problem

    Well, my intention was just to clarify the recursive solution in principle.

    Optimization is another story.

    The dictionary strategy they suggested probably was a memoization attempt to avoid...
  16. Replies
    6
    Views
    416

    Re: Increment or double problem

    That is a recursive formulation of the problem. In code it would look like this,



    int count(int a, int b) {
    if (a>b) return 0; // no solution
    else if (a==b) return 1; // one solution
    ...
  17. Replies
    5
    Views
    299

    Re: How to return a multidimensional array?

    If you plan to return a pointer to the 2D array you are asking for trouble. Chances are it gets stale and there will be a much harder to find runtime bug.

    The most immediate solution is to return...
  18. Replies
    19
    Views
    850

    Re: Dear Expert Help me out

    Yes but as the OP presents the problem it requires that both algorithms and keys are found by inspecting a number of encrypted and plain message combinations. That should not be possible according to...
  19. Replies
    1
    Views
    188

    Re: What is a binary heap?

    http://en.wikipedia.org/wiki/Binary_heap
  20. Replies
    2
    Views
    197

    Re: Return a list of defines given a range.

    If you are used to functional programming why not use a C++ functional library?
  21. Replies
    10
    Views
    447

    Re: RSA encryption algorithm in logarithm .

    To achieve that in a forum like this you need to formulate specific consise focused problems accessible to people who are not specialists in your field of technology.

    Also use English throughout.
  22. Replies
    17
    Views
    1,089

    Re: Sorted vector/list to set

    Yes this problems screams of please use a hash based set implementation and it did so 6 years ago already.

    And today there is the std::unordered_set so it is a no brainer really.
  23. Replies
    19
    Views
    850

    Re: Dear Expert Help me out

    If this is some sort of cryptosystem then the whole purpose is that you should not be able to find out. If you could then it would be no good.
  24. Replies
    17
    Views
    1,089

    Re: Sorted vector/list to set

    Rather than a tree based set I would consider a hash based set, and today there is the std::unordered_set.

    The loading order of the initial data will not be an issue and typical set operations...
  25. Re: A question regarding the size of a class with virtual functions

    It's implementation dependent so it's not part of the C++ language and nothing of great concern in everyday programming unless you're writing a C++ compiler or studying compiler technology.

    But...
Results 1 to 25 of 617
Page 1 of 25 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center