Re: [Dev-C++] Glib::ustring::assign(...)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Reid T. <rei...@at...> - 2007-08-18 00:31:04
|
Jamiil Abduqadir wrote:
> std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown"));
> if(!title.empty())
> {
> this->ustr->assign(title); // Segmentation Fault <<=====
> }
>
> Be my guest.
what's the definition of ustr????
does this example work on your system?
http://wwwasd.web.cern.ch/wwwasd/lhc++/RW/stdlibcr/aut_3512.htm
//
// auto_ptr.cpp
//
#include <iostream.h>
#include <memory>
//
// A simple structure.
//
struct X
{
X (int i = 0) : m_i(i) { }
int get() const { return m_i; }
int m_i;
};
int main ()
{
//
// b will hold a pointer to an X.
//
auto_ptr<X> b(new X(12345));
//
// a will now be the owner of the underlying pointer.
//
auto_ptr<X> a = b;
//
// Output the value contained by the underlying pointer.
//
cout << a->get() << endl;
//
// The pointer will be deleted when a is destroyed on
// leaving scope.
//
return 0;
}
Output :
12345
|