POV-Ray : Newsgroups : povray.off-topic : The History of C++... : Re: The History of C++... Server Time
10 Oct 2024 17:21:03 EDT (-0400)
  Re: The History of C++...  
From: Warp
Date: 18 Mar 2008 05:59:32
Message: <47dfa094@news.povray.org>
Chambers <ben### [at] pacificwebguycom> wrote:
> Why they couldn't just add a native string class to the 
> language itself eludes me at the moment."

  My guess: Because they wanted it to be possible for the user to specify
his own allocator for a string.

  One guiding principle I see throughout the C++ standard library is that
it's rather flexible: For example, containers don't fix the memory allocator
they use to allocate space, but let the user specify his own allocator if
he wants to use one (eg. because of efficiency in certain situations, or
to allow some kind of user-implemented automatic garbage collection).
Normally a default allocator is used, and the user doesn't need to worry
about it. However, if the user wants to replace the allocator, he can.

  If you think how you would add a native, language-level string (ie. not
just a class in a library) which would support a user-defined allocator
in C++, you would quite quickly find yourself reimplementing a templated
string class at language level.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.