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

Search:

Type: Posts; User: S__B

Search: Search took 0.04 seconds.

  1. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    I don't think this would work, as infinitely many points on "the sphere" will have the same key. So in the end the "find" will be indeterminate.
  2. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    A problem in that case would be that it won't result in something unique. Please correct me if I'm wrong.
  3. Replies
    6
    Views
    6,409

    Re: Not sure how parse this file correctly

    Perhaps read each line using "fgets" in a while loop, and then interpret it accordingly. If a line has a ",", then break, otherwise do whatever with the line string.


    while( fgets(line_buffer,...
  4. Replies
    11
    Views
    9,803

    Re: help with looping structure

    Either make the "votes", and "total" doubles, or typecast them as "double" while computing "percent".
  5. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    Thanks Lindley for pointing out a problem.



    Paul, you are suggesting a serious flaw in this implementation. I thought that when a value is fetched into an internal register, it is just mirrored...
  6. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    Thanks Lindley for the clarification. In this case, I'm "another code" trying to debug some of the inherited code, without crashing it down.
    The situation is that the keys instead of floats is the...
  7. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    QUESTION 1: I think I am missing something here. I am not sure how "map" will use "LessThan" for "find". Can you please explain, or point to a link?



    QUESTION 2: How to define a "LessThan"...
  8. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    But if I don't add or subtract anything, it should work? For example,
    1. an array initialized with all possible "floating point key values".
    2. map initialized with (key,item) where keys are used...
  9. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    I think I don't quite follow this. First, for std::map, I need to define LessThan() not EqualTo(). Correct? (this behavior is opposite to the hash_map, which I normally use) How this translates to...
  10. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    I need to use it for find. In fact, I am debugging someone's code and find this usage, and am a bit skeptical of it. So, I wrote a small test application, which seems to work quite fine. I don't see...
  11. Replies
    33
    Views
    22,115

    Re: float as a key in std::map

    I'm a bit confused with the working of map versus hash_map. For the hash_map the "Equal" is used to find the item, whereas the map seems to take "LessThan" as a template argument. Is that sufficient...
  12. Replies
    13
    Views
    1,624

    Re: does delete clear the memory?

    You are not freeing the memory correctly. Use

    delete [] secret;
  13. Replies
    33
    Views
    22,115

    float as a key in std::map

    Hi,
    It is reasonable to use floating point number as a key in std::map. Would it fail while trying to lookup for a keymap?
    Thanks
    SB
  14. Replies
    31
    Views
    15,245

    Re: how to read memory address and get its value

    Use typecasting:

    If "char* p" is the character pointer, then something like


    int n = *( (int *) p );

    is what you should be looking at.
  15. Replies
    2
    Views
    688

    Re: Debugging a Process with VS 2003

    I do have two monitors. Although the dialog is supposed to appear on the first one (its previous location as well as that of the VS IDE), I don't even find it on the second monitor either.
    ...
  16. Replies
    2
    Views
    688

    Debugging a Process with VS 2003

    Hi,
    Has anyone seen the following problem with VS.NET 2003 while debugging a process? If so, how to resolve it.

    When I do:

    Tools->Debug Processes…

    Sometimes nothing happens. No dialog...
  17. Thread: A compiler bug?

    by S__B
    Replies
    2
    Views
    764

    Re: A compiler bug?

    The dll is generated through project wizard in VC2003. In that sense MYDLL_API is standard:



    #ifdef MYDLL_EXPORTS
    #define MYDLL_API __declspec(dllexport)
    #else
    #define MYDLL_API...
  18. Thread: A compiler bug?

    by S__B
    Replies
    2
    Views
    764

    A compiler bug?

    Hi,
    I am exporting a class through a dll, which is then invoked via an application.

    The class is abstract, but then concrete implementations are provided through derived classes. One of the...
  19. Replies
    5
    Views
    1,010

    Re: Generic Collections

    But then how can I combine them to get something like:



    class CMatrix< T >
    {
    private int _m;
    private int _n;
    private double[,] _data;
  20. Replies
    5
    Views
    1,010

    Generic Collections

    Hi,
    While C# appeared similar to C++ on paper, I have started to struggle learning it. I started off with creating a generic matrix class, but soon simplified the problem to a class doing binary...
  21. Thread: Token pasting

    by S__B
    Replies
    3
    Views
    714

    Re: Token pasting

    What about token pasting?
    -SB
  22. Thread: Token pasting

    by S__B
    Replies
    3
    Views
    714

    Token pasting

    Hi,
    How can I use token pasting preprocessor directive? I need to call the right function given the function names in the form of an array.



    #define CallMyFun( p, n ) p->##n ();

    string...
Results 1 to 22 of 23





Click Here to Expand Forum to Full Width

Featured