boost::detail::sp_assert_convertible< Y, T >(); // it is now safe to copy r.px, as pn(r.pn) did not throw px = r.px; } template<class Y> shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ) BOOST_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp...
T *tmp = b.px; b.px = px; px = tmp; } typedef scoped_ptr<T> this_type; 当调用pp.reset(),reset 函数构造一个临时对象,它的成员px=0, 在swap 函数中调换 pp.px 与 (this_type)(p).px, 即现在pp.px = 0; //解绑 临时对象接管了裸指针(即所有权可以交换),reset 函数返回,栈上的临时...
boost::detail::sp_assert_convertible< Y, T >(); // it is now safe to copy r.px, as pn(r.pn) did not throw px = r.px; } template<class Y> shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ) BOOST_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp...
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) boost::sp_scalar_destructor_hook( px ); #endif boost::checked_delete( px ); } void reset(T * p = 0) // never throws { BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors this_type(p).swap(*this); } T & operator*...
所有针对资源的操作*,->都直接使用它来完成。 reference operator* () const // never throws { BOOST_ASSERT(px != 0); return *px; } T * operator-> () const // never throws { BOOST_ASSERT(px != 0)
boost::sp_scalar_destructor_hook( px ); #endif boost::checked_delete( px ); } void reset(T * p = 0) // never throws { BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors this_type(p).swap(*this); }
voidreset(T*p=0)// never throws{BOOST_ASSERT(p==0||p!=px);// catch self-reset errorsthis_type(p).swap(*this);}voidswap(scoped_ptr&b)// never throws{T*tmp=b.px;b.px=px;px=tmp;} typedef scoped_ptr<T> this_type; 当调用pp.reset(),reset 函数构造一个临时对象,它的成员px=0...
boost::progress_display pd(100); for (int i = 0; i < 100; ++i) //进度条 { ++pd; } boost::gregorian::date dt(2009, 12, 8); //date_time 库 assert(dt.year() == 2009); assert(dt.day() == 8); boost::gregorian::date::ymd_type ymd = dt.year_month_day(); ...
--define=MMWAVE_L3_CODEMEM_SIZE=0x100 --define=DOWNLOAD_FROM_CCS --define=DebugP_ASSERT_ENABLED --define=_LITTLE_ENDIAN --define=OBJDET_NO_RANGE --define=TRACKERPROC_EN --define=GTRACK_3D --define=AOP --define=APP_RESOURCE_FILE='<'C:/ti/mmwave_industrial...
boost常用库的使用介绍第二讲:boost智能指针库主讲人:步磊峰 UIPower 3D界面引擎负责人第一节: C程序员对内存管理的苦恼1内存泄漏memory leak2野指针wild pointer3访问越界access violati