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

Search:

Type: Posts; User: NMTop40

Page 1 of 80 1 2 3 4

Search: Search took 0.35 seconds.

  1. Replies
    16
    Views
    2,151

    Re: operator overloading

    He was going to change it to point to an empty string.

    As for operator+, it is to allow efficient implementation of this that the standard does not require that it internally holds a contiguous...
  2. Replies
    8
    Views
    1,164

    Re: Linked List swap

    If this is not practice but something you need in reality then use std::list and splice.
  3. Replies
    16
    Views
    2,151

    Re: operator overloading

    Problem of pointing it to "" is that your destructor is now trying to illegally delete it. Before when it was NULL it was ok to call delete on it, but you cannot call delete on the pointer here.
    ...
  4. Re: Passing an array of char arrays using plain old data types

    When you allocate memory inside a DLL you must always deallocate it in the same DLL, i.e. you must have some callback method to do the deletion, and not call delete from the client.

    If it is a...
  5. Replies
    4
    Views
    588

    Re: Variables and Class Constructors

    Using m_ as a prefix is quite a popular notation.
  6. Replies
    6
    Views
    866

    Re: Is this "good" coding style... ?

    The problem with the solution above is that OSXController and Win32Controller would need to be implemented even on the other platforms.

    with #defines you only need it to compile on the platform...
  7. Replies
    6
    Views
    3,498

    Re: C++ - Using STL queue dumps core

    I have written my own message queues (prodcon_queue) for multi-threaded systems but it is fairly complex. I had to write a mutex wrapper and a condition variable wrapper.

    boost may have one though...
  8. Re: Using friend classes can improve encapsulation

    Remember though that in Java there are no headers and forward declarations so you expose your class implementation to whoever is using the class. Yes you do have interfaces but they are like abstract...
  9. Thread: Java to C++

    by NMTop40
    Replies
    33
    Views
    4,296

    Re: Java to C++

    When I coded in Java I commonly made the mistake of forgetting to initialise members, eg collections, so I would for example have a vector as a class member and try using it forgetting that it was...
  10. Re: input from a file and storing in array of objects

    english, math and history looks like types of course, not types of student.

    public inheritance means "is a kind of".
  11. Replies
    9
    Views
    1,329

    Re: function returning memory address

    You've introduced a "magic" address into your code.

    You can do this sort of weird syntax in the IDE debugger where you see the pointers. Not normal to put it into your code.
  12. Thread: Help with nan

    by NMTop40
    Replies
    5
    Views
    4,341

    Re: Help with nan

    acos of 0 is well defined to be pi/2
  13. Replies
    11
    Views
    1,067

    Re: Create a class? And load it?

    1. You can use meta-programming which is what is happening with boost functions. You have a class that looks something like this:


    class func
    {
    public:
    void operator() ();
    }
  14. Re: Using friend classes can improve encapsulation

    Using friend can increase encapsulation over the alternative of leaving lots of members public because one closely-related class needs access to them.

    In the case of a class whose instances should...
  15. Replies
    5
    Views
    893

    Re: Temporaries problem (C++)

    You can use boost/tr1 here but you need a custom deleter to do nothing with the one passed in as a parameter.

    You can also possibly use auto_ptr which is left empty if not used.

    Example with...
  16. Re: what does #define do when there is no replacement

    If you put DATE_H in your code somewhere the compiler would replace it with no code.

    This is actually used sometimes for compiler-based situations in portable code where you need to insert certain...
  17. Replies
    4
    Views
    3,050

    Re: Miller Rabin Primality Test Wrong Result

    One guess for a start is that MSSB is reading from the wrong side, but do not convert to a string and use find_first_of, why not just use std::bitset's in-built functions?
  18. Re: "function call missing argument list; use '&function' to create a pointer to memb

    You would do the above so you can pass f to a C API for example as a thread function (although they don't normally return double).
  19. Re: "function call missing argument list; use '&function' to create a pointer to memb

    If you specify a default value for the function then you can call it without passing in an argument.

    What I think you are looking for though here is a callback function, and there are differences...
  20. Thread: Java to C++

    by NMTop40
    Replies
    33
    Views
    4,296

    Re: Java to C++

    What you must pick up in C++ that is not there in Java is having to manage resources by use of automated destructors.

    C++ does not have memory garbage collection the way Java has it but does have...
  21. Re: "function call missing argument list; use '&function' to create a pointer to memb

    This seems to be two questions in one, one regarding arrays/vectors and another regarding passing a member function as a parameter.
  22. Replies
    16
    Views
    2,151

    Re: operator overloading

    You have a constructor with a default parameter to an invalid value. If someone constructs a FunnyString with its default constructor it will cause undefined behaviour (probably access violation /...
  23. Replies
    7
    Views
    999

    Re: C++ error...cant find it in my code HELP

    You have 2 source files and both of them need to be built then linked together.

    It seems strange though that you are using the command-line linker.

    By the way, while we are here make main()...
  24. Replies
    4
    Views
    3,050

    Re: Miller Rabin Primality Test Wrong Result

    I don't know the test but there are a few things funny about your code sample. I guess some of the one-letter identifiers may be "standard" within the mathematical realm of that formula, however...
    ...
  25. Replies
    6
    Views
    1,278

    Re: Binary IO with Objects and Vectors

    ios_base::binary can be quite confusing and I know I was caught out at first. I also expected that if I set the stream to binary it would put the numbers in in a binary format. I also thought the API...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4





Click Here to Expand Forum to Full Width

Featured