user3841735
user3841735

Reputation: 117

C++ adjust std::string to have 16 bytes size maximum

I'm porting MSVC6 application to MSVC9 as the old size of std::string is 16 bytes (this one is from a 1998 package) and the new one is 32 bytes which completely makes my application impossible to work since it was built with 4 byte alignment option and uses some size checking/comparing compatible with the old size.

I need to reimplement this MSVC6 std::string... or just use some smaller string implementation.

Is it possible to make current size of std::string smaller e.g. by using some different allocator or something? I need to make it working.

//MSVC6 Works
//MSVC9 Not...
class myappstring : std::string
{

};

Upvotes: 2

Views: 263

Answers (1)

bames53
bames53

Reputation: 88215

The default allocator isn't stored in std::string instances so it shouldn't have any effect on the size of std::strings. You'll simply have to switch to another string implementation, perhaps one you've written to meet your requirements.

Upvotes: 2

Related Questions