Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <tchar.h>
- #define BOOST_HAS_RVALUE_REFS
- #include <d:\Coding\MSVS 2010\VC\boost_1_48_0\boost\config\compiler\visualc.hpp>
- #include <d:\Coding\MSVS 2010\VC\boost_1_48_0\boost\shared_ptr.hpp>
- #include <d:\Coding\MSVS 2010\VC\boost_1_48_0\boost\make_shared.hpp>
- class CBase
- {
- public:
- virtual ~CBase()
- {
- }
- };
- class CDerived
- : public CBase
- {
- };
- namespace
- {
- boost::shared_ptr< CBase > f()
- {
- auto pRes = boost::static_pointer_cast< CBase >( boost::make_shared< CDerived >() );
- // ... Doing something with pRes
- return std::move( pRes );
- }
- }
- int _tmain( int argc, _TCHAR* argv[] )
- {
- auto p = f();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement