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.
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.
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.
Have you looked at STLPort or the Dinkum TR1 library ? Both have a much more complete port for CE.
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:
//preferred
ptr<SomeClass> p1(new SomeClass);
//less safe
ptr<SomeClass> p2 = new SomeClass;
Why the second from would be 'less safe'?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.