力為的技術(shù)博客
聯(lián)系
聚合
管理
154 Posts :: 1 Stories :: 561 Comments :: 0 Trackbacks
公告
@上海浦東
常用鏈接
我的隨筆
我的評(píng)論
我參與的隨筆
留言簿
(58)
給我留言
查看公開(kāi)留言
查看私人留言
隨筆分類
(154)
2. Graphics(10)
3. VC&MFC&Qt(35)
4. C++ FAQ(35)
5. GP&STL&BOOST(10)
6. COM&ATL&WTL(5)
7. OGRE Analysis(14)
8. ACIS/HOOPS(4)
9.OpenCASCADE(13)
Mac&iOS(5)
Mac&iOS(1)
Tools(22)
積分與排名
積分 - 716083
排名 - 22
最新評(píng)論
1.?re: 2015武漢校園招聘歸來(lái)
@eryar
時(shí)間安排的太緊,就沒(méi)有驚擾你啦。
--力為
2.?re: 2015武漢校園招聘歸來(lái)
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--sunyuanbo
3.?re: 2015武漢校園招聘歸來(lái)
謝謝 您的筆記讓我受益匪淺
--仝錫林
4.?re: 2015武漢校園招聘歸來(lái)
不知道來(lái)武漢了啊!
--eryar
5.?re: 2015武漢校園招聘歸來(lái)
@力為
謝謝提醒,還在學(xué)習(xí)中。。。
--編程小學(xué)徒
6.?re: 2015武漢校園招聘歸來(lái)
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--編程小學(xué)徒
7.?re: 2015武漢校園招聘歸來(lái)[未登錄](méi)
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--chipset
8.?re: 2015武漢校園招聘歸來(lái)
@編程小學(xué)徒
考研也不僅僅靠有編程興趣就夠了,還有其他的課程。好好準(zhǔn)備吧,祝考試順利。
--力為
9.?re: 2015武漢校園招聘歸來(lái)
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--編程小學(xué)徒
10.?re: 2015武漢校園招聘歸來(lái)[未登錄](méi)
為了混口飯吃,大家都不容易啊,原諒刷題的同學(xué)吧。話說(shuō)學(xué)校里能教啥呀,都靠自己用心,有上進(jìn)心才是最重要的,否則筆試面試再好也是白扯。從面試官的角度看考試沒(méi)有錯(cuò),換成我會(huì)找有潛力的或者上進(jìn)心強(qiáng)的。
--chipset
11.?re: 【代碼】使用Teigha讀取DWG
要用vs2010編譯么?
--jj
12.?re: 臨時(shí)對(duì)象引用[未登錄](méi)
最后一個(gè)例子也是零時(shí)變量?
--zhonghuajia
13.?re: 為什么需要給函數(shù)返回類型加const
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--冬瓜
14.?re: 【代碼】使用Teigha讀取DWG
歡迎加入QQ群122751318,討論Teigha
--Teigha開(kāi)發(fā)
15.?re: CMake + Qt5.1.0
@MIKE
還是不行。
不管是prefix還是library還是include,都嘗試過(guò)了,不行,網(wǎng)上的方法都不行……
--Delbert
評(píng)論排行榜
1.?Pro OGRE 3D Programming 電子版(54)
2.?手機(jī)號(hào)碼黑名單(53)
3.?屏幕截圖工具V1[附源碼](22)
4.?波形顯示不是很難(15)
5.?五個(gè)小矮人分桃子-一道小學(xué)生的作業(yè)題目(15)
6.?用istringstream 解決問(wèn)題一則(14)
7.?用CImage加載內(nèi)存里的Image(14)
8.?fstream 和 中文路徑(13)
9.?OGRE動(dòng)畫(huà)練習(xí)(13)
10.?VC+ADO操作數(shù)據(jù)庫(kù)注意事項(xiàng)(1)(13)
11.?OGRE粒子系統(tǒng)之在烈火中永生(11)
12.?如何通過(guò)FILE*操作內(nèi)存文件?(11)
13.?VC2008 Feature Pack的問(wèn)題(11)
14.?升級(jí)到 VS2008 SP1 注意問(wèn)題(11)
15.?失足于shared_ptr(11)
const auto_ptr保證擁有權(quán)不能轉(zhuǎn)移的實(shí)現(xiàn)原理?
const auto_ptr保證擁有權(quán)不能轉(zhuǎn)移的實(shí)現(xiàn)原理?
在《C++標(biāo)準(zhǔn)程序庫(kù)》p55,提到了auto_ptr使用了一個(gè)技巧,能夠copy和復(fù)制non-const auto_ptr,但不可以copy和復(fù)制const atuo_ptr。
可看了之后沒(méi)感覺(jué),等待高手指點(diǎn)中.....
CSDN領(lǐng)分之處:
http://community.csdn.net/Expert/topic/4347/4347660.xml?temp=.3555872
VC7的
//
VC7中的
//
TEMPLATE CLASS auto_ptr
template
<
class
_Ty
>
class
auto_ptr;
template
<
class
_Ty
>
struct
auto_ptr_ref
{
//
proxy reference for auto_ptr copying
auto_ptr_ref(auto_ptr
<
_Ty
>&
_Right)
: _Ref(_Right)
{
//
construct from compatible auto_ptr
}
auto_ptr
<
_Ty
>&
_Ref;
//
reference to constructor argument
}
;
template
<
class
_Ty
>
class
auto_ptr
{
//
wrap an object pointer to ensure destruction
public
:
typedef _Ty element_type;
explicit
auto_ptr(_Ty
*
_Ptr
=
0
) _THROW0()
: _Myptr(_Ptr)
{
//
construct from object pointer
}
auto_ptr(auto_ptr
<
_Ty
>&
_Right) _THROW0()
: _Myptr(_Right.release())
{
//
construct by assuming pointer from _Right auto_ptr
}
auto_ptr(auto_ptr_ref
<
_Ty
>
_Right) _THROW0()
: _Myptr(_Right._Ref.release())
{
//
construct by assuming pointer from _Right auto_ptr_ref
}
template
<
class
_Other
>
operator
auto_ptr
<
_Other
>
() _THROW0()
{
//
convert to compatible auto_ptr
return
(auto_ptr
<
_Other
>
(
*
this
));
}
template
<
class
_Other
>
operator
auto_ptr_ref
<
_Other
>
() _THROW0()
{
//
convert to compatible auto_ptr_ref
return
(auto_ptr_ref
<
_Other
>
(
*
this
));
}
template
<
class
_Other
>
auto_ptr
<
_Ty
>&
operator
=
(auto_ptr
<
_Other
>&
_Right) _THROW0()
{
//
assign compatible _Right (assume pointer)
reset(_Right.release());
return
(
*
this
);
}
template
<
class
_Other
>
auto_ptr(auto_ptr
<
_Other
>&
_Right) _THROW0()
: _Myptr(_Right.release())
{
//
construct by assuming pointer from _Right
}
auto_ptr
<
_Ty
>&
operator
=
(auto_ptr
<
_Ty
>&
_Right) _THROW0()
{
//
assign compatible _Right (assume pointer)
reset(_Right.release());
return
(
*
this
);
}
auto_ptr
<
_Ty
>&
operator
=
(auto_ptr_ref
<
_Ty
>&
_Right) _THROW0()
{
//
assign compatible _Right._Ref (assume pointer)
reset(_Right._Ref.release());
return
(
*
this
);
}
~
auto_ptr()
{
//
destroy the object
delete _Myptr;
}
_Ty
&
operator
*
()
const
_THROW0()
{
//
return designated value
return
(
*
_Myptr);
}
_Ty
*
operator
->
()
const
_THROW0()
{
//
return pointer to class object
return
(
&**
this
);
}
_Ty
*
get
()
const
_THROW0()
{
//
return wrapped pointer
return
(_Myptr);
}
_Ty
*
release() _THROW0()
{
//
return wrapped pointer and give up ownership
_Ty
*
_Tmp
=
_Myptr;
_Myptr
=
0
;
return
(_Tmp);
}
void
reset(_Ty
*
_Ptr
=
0
)
{
//
destroy designated object and store new pointer
if
(_Ptr
!=
_Myptr)
delete _Myptr;
_Myptr
=
_Ptr;
}
private
:
_Ty
*
_Myptr;
//
the wrapped object pointer
}
;
posted on 2005-10-24 22:07
力為
閱讀(1141)
評(píng)論(3)
編輯
收藏
引用
所屬分類:
5. GP&STL&BOOST
評(píng)論
#
re: const auto_ptr保證擁有權(quán)不能轉(zhuǎn)移的實(shí)現(xiàn)原理? 2005-10-24 23:32
ilovevc
要不看看我寫(xiě)的
http://blog.csdn.net/ilovevc/archive/2005/09/09/475896.aspx
回復(fù)
更多評(píng)論
#
re: const auto_ptr保證擁有權(quán)不能轉(zhuǎn)移的實(shí)現(xiàn)原理? 2005-10-25 09:22
ly4cn
const auto_ptr
對(duì)于const實(shí)體來(lái)說(shuō),只有類的構(gòu)造函數(shù)、析構(gòu)函數(shù)和聲明后帶有const的函數(shù)允許調(diào)用。
因此,對(duì)于const auto_ptr<>來(lái)說(shuō),它允許調(diào)用成員函數(shù)只有:get,operator*,operator->。
明顯的,這幾個(gè)函數(shù)不能轉(zhuǎn)移所有權(quán)。
而用于轉(zhuǎn)移所有權(quán)的release,reset等等函數(shù)均不能調(diào)用。如果調(diào)用了,將產(chǎn)生編譯期錯(cuò)誤。
回復(fù)
更多評(píng)論
#
re: const auto_ptr保證擁有權(quán)不能轉(zhuǎn)移的實(shí)現(xiàn)原理?
2005-10-26 10:08
力為
多謝各位的提供的資料:)
回復(fù)
更多評(píng)論
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
【推薦】100%開(kāi)源!大型工業(yè)跨平臺(tái)軟件C++源碼提供,建模,組態(tài)!
相關(guān)文章:
Buffer和std::stream
[Ideas] Generic Serialization Framework
我的原創(chuàng)技術(shù)隨筆大全(2000~2009)
Boost.Python與C++互操作的問(wèn)題(更新)
boost::any 與 boost::variant 的區(qū)別
An Adapter Solution
fstream 和 中文路徑
用std::find查找文件流中的內(nèi)容
const auto_ptr保證擁有權(quán)不能轉(zhuǎn)移的實(shí)現(xiàn)原理?
網(wǎng)站導(dǎo)航:
博客園
IT新聞
BlogJava
博問(wèn)
Chat2DB
管理
Powered by:
C++博客
Copyright © 力為
日本欧美国产精品第一页久久
|
久久综合一区二区无码
|
1000部精品久久久久久久久
|
2021少妇久久久久久久久久
|
久久播电影网
|
久久婷婷国产综合精品
|
国产亚洲精久久久久久无码AV
|
伊人久久大香线蕉av不卡
|
91精品婷婷国产综合久久
|
精品国产乱码久久久久软件
|
亚洲成色999久久网站
|
亚洲午夜无码久久久久
|
激情综合色综合久久综合
|
久久人人妻人人爽人人爽
|
久久99久久无码毛片一区二区
|
久久久久久久久久久久中文字幕
|
国产午夜精品理论片久久
|
国产精品美女久久久久网
|
青青草原综合久久大伊人
|
久久99精品免费一区二区
|
久久国产精品国产自线拍免费
|
丁香色欲久久久久久综合网
|
日本加勒比久久精品
|
久久91精品综合国产首页
|
伊人色综合久久
|
四虎国产永久免费久久
|
99国产欧美精品久久久蜜芽
|
亚洲香蕉网久久综合影视
|
婷婷国产天堂久久综合五月
|
人妻丰满?V无码久久不卡
|
久久高潮一级毛片免费
|
国产精品久久久久乳精品爆
|
亚洲国产精品嫩草影院久久
|
国产精品热久久无码av
|
segui久久国产精品
|
色综合久久天天综合
|
精品久久久久久无码人妻蜜桃
|
国产农村妇女毛片精品久久
|
久久久亚洲精品蜜桃臀
|
久久丝袜精品中文字幕
|
国产毛片久久久久久国产毛片
|