Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.iso-c++ > #2092
| From | ram@zedat.fu-berlin.de (Stefan Ram) |
|---|---|
| Newsgroups | de.comp.lang.iso-c++ |
| Subject | Re: std::string und eigener allocator |
| Date | 2018-11-08 18:49 +0000 |
| Organization | Stefan Ram |
| Message-ID | <String-Allokator-20181108194619@ram.dialup.fu-berlin.de> (permalink) |
| References | <6esh0b8w2x.fsf@th-dorner.de> |
Thomas Dorner <td-dclic01@th-dorner.de> writes: >T* allocate(std::size_t n, const void* = 0) Hier könnte man statt »= 0« auch schreiben: »= nullptr«. >std::string mystring(customAllocator); Nach dieser Zeile bestätigt ein ::std::cout <<( mystring.get_allocator() == customAllocator )<< '\n'; , daß der Spezialallokator im Prinzip angekommen ist. Aber stackoverflow.com: |std::string is a typedef of basic_string that already |explicitly uses the default allocator. There is no way for |std::string to use a different allocator. "Mark B"? (std::string ist ein typedef von basic_string, die bereits explizit den Standardallokator verwendet. Es gibt keine Möglichkeit, für std::string, einen anderen Allokator zu verwenden.) , cplusplus.com: |All constructors above support an object of member type |allocator_type as additional optional argument at the end, |which for string is not relevant (Alle Konstruktoren oben unterstützen ein Objekt vom Typ allocator_type als zusätzliches optionales Argument am Ende, das für ::std::string nicht relevant ist.) . Dementsprechend wird meist von »basic_string« ausgegangen, stackoverflow.com: |typedef basic_string<char, char_traits<char>, |my_allocator<char> > my_string; "GManNickG"? .
Back to de.comp.lang.iso-c++ | Previous | Next — Previous in thread | Next in thread | Find similar
std::string und eigener allocator Thomas Dorner <td-dclic01@th-dorner.de> - 2018-11-08 15:47 +0100 Re: std::string und eigener allocator ram@zedat.fu-berlin.de (Stefan Ram) - 2018-11-08 18:49 +0000 Re: std::string und eigener allocator Markus Schaaf <mschaaf@elaboris.de> - 2018-11-12 12:25 +0100
csiph-web