STL vs hand-coded

This is a discussion on STL vs hand-coded within the C++ Programming forums, part of the General Programming Boards category; Even virtuals don't take up space in the class instance; merely the vptr does. (That's for most C++ implementatons - ...

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Even virtuals don't take up space in the class instance; merely the vptr does. (That's for most C++ implementatons - in theory they're free to do something different.)

    However, I think sean meant member variables: the size tracker and the pointer to the heap memory, and possibly member variables of the allocator.

    for example, the 'sqrt()' function. if you've come up with a better/faster algorithm of finding the square root of a number, then by all means, use it! if not, just stick to the sqrt() function provided by the STL.
    sqrt() is part of the CRT, not the STL. That aside, it's rather unlikely that you come up with a faster sqrt() than the one you have, while keeping its precision.
    If you don't need that precision, it's a different story.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #17
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    However, I think sean meant member variables:
    Sure, whatever makes me sound smarter.

  3. #18
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    Even virtuals don't take up space in the class instance; merely the vptr does. (That's for most C++ implementatons - in theory they're free to do something different.)

    However, I think sean meant member variables: the size tracker and the pointer to the heap memory, and possibly member variables of the allocator.
    On second thought, the program must take some hardisk space to store non-inlined member functions(and presumably the program or pieces of the program are read into memory). vector operations are pretty much always going to be inlined. They're take up code space, but only if they're called.

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I really, really don't think that the ~2kB I estimate a vector to use at the very maximum really matter.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Formatting Using STL
    By ChadJohnson in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2004, 05:52 PM
  2. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-24-2004, 12:22 AM
  3. STL or no STL
    By codec in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2004, 03:36 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 08:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 04:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21