Take the 2-minute tour ×

I cannot get std::tr1::shared_ptr for my WinMobile project since the STL for WinCE is maintained by a different team at Microsoft :( aarrgh...

Anyone worked with another thread-safe, reference counting smart pointers? I'm actually using yasper which seems to be good.

Thank you very much.

share|improve this question
Again, I should have checked StackOverflow first. Installed VS2008 SP1 in high hopes, yet 'std::shared_ptr' still not there. What the...?!? Nowhere does MS state that hey, btw, Windows CE is not going to get this. They should burn, slow and steady. Or actually they should join teams so we only have one toolchain. Problem is, they can afford this and the pain is ours, not theirs. :/ Thanks SO for setting the technical details straight. Again. –  akauppi Sep 30 '11 at 12:38
add comment

5 Answers

up vote 4 down vote accepted

I'd also recommend boost::shared_ptr. You can do what I did for a library, and use a #define to switch between std::tr1::shared_ptr and boost::shared_ptr, depending on the capabilities of the compiler. That way your code doesn't need to be modified [much] if/when the CE team add tr1 support. Just my 2c.

share|improve this answer
add comment

Boost Smart Pointers. In particular boost::shared_ptr. I am pretty sure they are supported for your platform. This is where tr1::shared_ptr came from.

share|improve this answer
add comment

Have you looked at STLPort or the Dinkum TR1 library? Both have a much more complete port for CE.

share|improve this answer
add comment

yasper::ptr seems to be similar to Boost Smart Pointers, altough shared_ptr of course has more features.

In the scarce yasper::ptr documentation an example of pointer assignment appears:

ptr<SomeClass> p1(new SomeClass);

 //less safe  
ptr<SomeClass> p2 = new SomeClass;

Why the second from would be 'less safe'?

share|improve this answer
it's less safe because that is an implicit conversion from a raw pointer to ptr<> template. consider void function(ptr<foo> f) { } foo * p = new foo; function(p); p->bar = 10; // oops –  Johannes Schaub - litb Dec 21 '08 at 5:36
Thank you very much for your response. That means p->bar may be invalid since p address was released by the smart pointer at function scope termination? –  Hernán Dec 21 '08 at 6:07
add comment

Yes I'm thinking into using shared_ptr, but Visual C++ 2008 does not have it under std::tr1 for WinCE builds, so may be I look those alternatives, thank you. I'm happy with yasper::ptr but I doubt it's thread safe.

share|improve this answer
add comment

Your Answer


