On Tue, Jan 5, 2010 at 3:02 PM, manish bhatia <[email protected]> wrote:
> #include <iostream>
> #include <new>
> #include <string>
> int main()
> {
> char* mem = new char[sizeof(std::string)];
> std::string& s = *new(mem) std::string("manish");
> std::cout << s << std::endl;
Looks vaguely like you're trying for placement new
http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10
>
> // s.~std::string();
> using std::string;
> s.~string();
See link above.
> delete[] mem;
> }
--
PJH
http://shabbleland.myminicity.com/
http://www.chavgangs.com/register.php?referer=9375
http://www.kongregate.com/?referrer=Shabble