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

Search:

Type: Posts; User: Richard.J

Page 1 of 46 1 2 3 4

Search: Search took 0.05 seconds.

  1. Thread: find_if

    by Richard.J
    Replies
    2
    Views
    443

    Re: find_if

    The find_if algorithm iterates over the elements of the container. In your case, the container is map<TDummyKey,TDummy>, and each element in the container is a pair<const TDummyKey, TDummy>.
    Your...
  2. Re: Socket Programming -- Sending image and received notice.

    I assume your server is not listening on port 50007, since you #define'd SERVER_PORT htons(50007).
    You can verify this by using TcpView (or netstat) and check what port your server is listening on....
  3. Re: How to create a function for storing object in map?

    A common index to be used in different kinds of maps seems odd to me. In addition, your Create method must take a M& to work correctly (like in laserlight's example).
    Apart from that, I am not sure...
  4. Re: How to create a function for storing object in map?

    All you need is the correct definition of your Create method


    void Create(std::map& map, const Account& object) const

    This assumes that Create does not modify the object passed into it and...
  5. Re: C Question: I want to convert an int to string of size n and pad with 0's.

    Look up for the '*' in the format string, like


    sprintf(str, "%0*d", 8, i);

    (not tested, though). This should make you able to replace the hard-coded 8 by a variable.
  6. Replies
    7
    Views
    1,111

    Re: Linker error with pure virtual function.

    The linker expects both classes to be defined in the namespace 'serial'. From the code you posted, it's not clear if you really defined the classes in this namespace.
  7. Replies
    2
    Views
    483

    Re: problem implementing 'type erasure'

    Well, I know a bit about virtual destructors. What I don't understand is how a class that wraps an iterator influences the destruction of the map. How are these things related?
  8. Replies
    2
    Views
    483

    problem implementing 'type erasure'

    I am playing around with 'type erasure' (see these links: https://akrzemi1.wordpress.com/2013/11/18/type-erasure-part-i/, http://www.artima.com/cppsource/type_erasure2.html).
    For this purpose, I...
  9. Re: Finding the nth prime number in fibonacci sequence

    The first thing I can spot is that both of your for-loops only end when the loop variable overflows, i.e. primecount is alsways <= 8 until it wraps from -2147483648 to 2147483647 and vice versa for...
  10. Replies
    5
    Views
    547

    Re: Destructor for a pointer in class

    Well, if you just use the pointer to store a reference to the 'parent' class, you must not delete it. Otherwise, in the CreateSessInfo destructor you would delete your object containing the...
  11. Replies
    5
    Views
    547

    Re: Destructor for a pointer in class

    You don't show where pClassInstance1 and pClassInstance2 are created (using new).
    If they are created inside CClass/DedBearerInfo, then you have to delete them in the destructor. You might be better...
  12. Re: Returning a boost::shared_ptr from the stack without constructing it?

    Do you mean


    return boost::shared_ptr<AStarPath>(new AStarPath(from, transitions, totalCost));
  13. Re: error C2678: binary '

    std::set expects operator< to be defined for AABB. Either provide that or create the std::set<AABB, customCompare>...
    Lookup "relational operators" here:...
  14. Re: What is the common technique of using pointers to change some value on the fly?

    But most of all: you have started a question, got no replies, then edited your original post and replaced your question with a completely different one. You are here long enough to know that this is...
  15. Re: error: prototype for 'int miniBag::add(const T&)' does not match any in class

    Why are you posting the same errorneous code you've presented to us here: http://forums.codeguru.com/showthread.php?549529-I-m-having-problems-configuring-my-template-class?
    You should at least have...
  16. Re: Dequeuing Integer Values From Heap Results In Garbage Values

    This


    for (int i = h1.size() - 1; i < 0; i--)

    is wrong. Your loop is never executed because "i < 0" is false. It should read


    for (int i = h1.size() - 1; i >= 0; i--)
  17. Re: I'm having problems configuring my template class

    Inside your add method, you are trying to do


    if(!vec.has(item))

    but vec is a std::vector, which doesn't provide a has method.
    Either use


    if(!this->has(item))
  18. Re: I'm having problems configuring my template class

    Use 'template' instead of 'Template'. C/C++ is case-sensitive.
  19. Replies
    3
    Views
    649

    Re: read file content line by line

    What exception do you get?
    And why do you use 'new' for the file_mapping and mapped_region?
  20. Replies
    3
    Views
    2,019

    Re: identifier not found

    Thanks for correcting me, 2kaud.
    I just did a quick google without further reading when I spotted conio.h.
  21. Replies
    3
    Views
    2,019

    Re: identifier not found

    for clrscr/gotoxy, you need to


    #include <conio.h>

    and for this:


    file_ptr = fopen ( "C:\dict.anu", "r" );
  22. Replies
    2
    Views
    789

    Re: WSAStartup best practices?

    The online documentation of WSAStartup says
    "An application must call the WSACleanup function for every successful time the WSAStartup function is called. "...
  23. Re: How to initialize an array of DirectX9 Objects?

    I am not sure if I understand correctly.
    Say you have


    int *p = new int[3];

    This leaves you with a default initialised array which may contain any value, depending on the compiler, doesn't...
  24. Re: How to initialize an array of DirectX9 Objects?

    Is this

    not called "value initialisation" as opposed to "default initialisation" which, for POD types, does nothing at all?
  25. Re: Nonblocking connect and select() for writing

    Since the connect() call is done on the loopback address, the socket may seem to be connected immediately. I guess you would see a different behaviour using two different machines.
    I googled this:...
Results 1 to 25 of 1139
Page 1 of 46 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


HTML5 Development Center