Unfortunately, smart pointers are not so simple, so the implementation can be quite complicated. Having said that, if you use g ++, you get things like shared_ptr without using Boost:
#include <memory>
using namespace std;
int main() {
shared_ptr <int> p( new int );
}
but you have to compile the flag -std=c++0x.
anon
source
share