可以去看一下二叉樹(shù)的遞歸,相信應(yīng)該有幫助
使用線程執(zhí)行 demux_thread 任務(wù)時(shí),主線程要等待它返回(可用 SDL_WaitThread()
),否則 main() 函數(shù)返回時(shí)將強(qiáng)制結(jié)束其他線程。
@felix 老大已經(jīng)完全解答了OP你的問(wèn)題, 窩稍微做點(diǎn)微不足道的補(bǔ)充:
foo
此時(shí)會(huì)對(duì)所有X<T>可見(jiàn). 那么就等于X<int>間接不合理的獲取了所有X<T>的信息(比如其private member). 所以不建議使用, 比如下段代碼可以過(guò)編譯.#include<iostream>
using namespace std;
template<typename T>
class A
{
private:
T x;
void setter(T y)
{
x = y;
}
public:
explicit A(T a) : x(a) {}
template<typename U>
friend void foo(A<U> a);
};
A<int> x(7);
template<typename U>
void foo(A<U> a)
{
x.x = 2;
}
int main()
{
A<int> a(7);
A<float> b(1.1);
foo(b);
}
首先靜態(tài)成員變量count需要在類(lèi)外定義
從c++1z開(kāi)始可能需要改成首先non-constexpr的靜態(tài)成員變量count需要在類(lèi)外定義。
詳見(jiàn)http://eel.is/c++draft/depr.s... . demo可以在寫(xiě)個(gè)odr-use函數(shù)試出.#include<iostream>
using namespace std;
template<class T, int n>
class Array;
template<class T, int n>
istream & operator>> (istream & in, Array<T,n>& a);
template<class T,int n>
ostream & operator << (ostream & out,const Array<T,n>& a);
template<class T, int n>
class Array
{
private:
T p[n];
static int count;
public:
friend istream & operator>> <> (istream & in, Array<T,n>& a);
friend ostream & operator << <> (ostream & out,const Array<T,n>& a);
int getSize()
{
return n;
}
static int getArrayCount()
{
return count;
}
};
template<class T,int n>
istream & operator >> (istream & in, Array<T,n>& a)
{
for(int i=0;i<n;i++)
{
in>>a.p[i];
}
a.count++;
return in;
}
template<class T,int n>
ostream & operator << (ostream & out,const Array<T,n>& a)
{
for(int i=0;i<n;i++)
{
out<<a.p[i]<<" ";
}
return out;
}
template<class T, int n>
int Array<T, n>::count = 0;
int main()
{
Array< int, 5 > intArray1;
cin >> intArray1;
Array< int, 5 > intArray2;
cin >> intArray2;
Array< float, 5 > floatArray;
cin >> floatArray;
cout << "\nIntArray1 contains " << intArray1.getSize() << " Elements.\n";
cout << "The values in intArray are:\n";
cout << intArray1;
cout << "\nIntArray2 contains " << intArray2.getSize() << " Elements.\n";
cout << "The values in intArray are:\n";
cout << intArray2;
cout << "\nDoubleArray contains " << floatArray.getSize() << " Elements.\n";
cout << "The values in the doubleArray are:\n";
cout << floatArray;
cout << "\nThere are " << Array<int,5>::getArrayCount() << " Array<int,5> objects.\n";
cout << "\nThere are " << Array<float,5>::getArrayCount() << " Array<float,5> objects.\n";
return 0;
}
path:'/index',
name:'index',
component:index,
redirect:'/device/deviceDisplay',
children:[
{
path:'/device/user',
name:'user',
component:user,
children:[
{
path: '/device/deviceDisplay',
name: 'deviceDisplay',
component: deviceDisplay
}
]
}
我理解的是默認(rèn)選中第一個(gè),用重定向
代理軟件地址
proxies = {
"http": "http://127.0.0.1:8080"
}
requests.post(url=url, json=joindata, proxies=proxies,verify=('FiddlerRoot.pem'))
verify同目錄下的Fiddler證書(shū),F(xiàn)iddler就能抓到包了
As what @felix said in comments: this
is BinarySearchTree const *
in template <typename T> bool BinarySearchTree<T>::contains(const T& x) const
whereas it is BinarySearchTree*
in bool contains(const T& x, BinaryNode<T>* rt);
Apparently, it is not allowed to pass BinarySearchTree const*
to BinarySearchTree*
(this
is a implicit parameter in member function), so you can nerve call non-const-qualifier member function from const-qualifier member function.
template <typename T>
bool BinarySearchTree<T>::contains(const T& x) const {
return const_cast<BinarySearchTree *>(this)->contains(x, root);
}
But this solution will cause undefined behaviour
, so another solution is here
This answer may also help you
你先不用5個(gè)數(shù),我給你個(gè)測(cè)試數(shù)據(jù):[2,1,3]
你自己在紙上跟著程序單步跑一跑你就明白你問(wèn)題出來(lái)在哪了。
c++有一個(gè)叫做xlslib的庫(kù),應(yīng)該可以實(shí)現(xiàn)
filters(option,rs){
option.forEach((r,i)=>{
r.keys=rs.keys ? rs.keys+'-'+Number(i+1) : Number(i+1)+'';
if(r['items']){
this.filters(r.items,r)
}
})
return option
},
segmentfault也是問(wèn)答平臺(tái),也可以解決你的問(wèn)題。而且,stack overflow都是英文交流,很懷疑你怎么提問(wèn)題。如果用中文提,sf適合你
re.compile(r"select.*?from.*?where.*?;", re.S|re.M)
?
因?yàn)閖avascript是高級(jí)語(yǔ)言
高級(jí)語(yǔ)言的定義和gc無(wú)關(guān), c++也是高級(jí)語(yǔ)言
優(yōu)雅和細(xì)節(jié)關(guān)系大么, 雖然c++的確不優(yōu)雅, 畢竟有那么重的歷史包袱, 但是js可是公認(rèn)的不優(yōu)雅啊, 雖然這并不影響js的流行.
允許處理細(xì)節(jié)也和優(yōu)雅無(wú)關(guān), 現(xiàn)代c++用好11開(kāi)始的那些工具. 這只是允許處理罷了, 當(dāng)然也可以選擇不處理, 比如各種smart pointer也可以寫(xiě)的比較優(yōu)雅
$PATH
(打開(kāi)adb shell可查看該環(huán)境變量)對(duì)應(yīng)的目錄下注意在insert()
中, last
是有++
操作的, 所以你在用這個(gè)順序表插入的時(shí)候last會(huì)自己更新.
且在初始化時(shí)令last=-1,表示初始化為一個(gè)空表(我的理解是只有一個(gè)元素,表中最后位置就是0,所以-1就表示一個(gè)空表,應(yīng)該是這樣吧)
last = -1只是說(shuō)明里面沒(méi)有元素. 這是在構(gòu)造函數(shù)里完成的.
至于你在find()
里提到的疑惑, 是因?yàn)槟憧隙ㄏ纫?code>insert(), 再find()
, 這時(shí)last已經(jīng)不是-1
了, 因?yàn)楹戏ǖ?code>insert()過(guò)了.
PS: 不過(guò)這本書(shū)的碼風(fēng)很糟糕, 窩覺(jué)得或許你該找好一點(diǎn)的材料學(xué)習(xí)(不過(guò)講道理, 數(shù)據(jù)結(jié)構(gòu)/算法的書(shū)基本碼風(fēng)都一塌糊涂...至少國(guó)外的書(shū)是這樣(除了clrs這樣用偽碼的), 國(guó)內(nèi)不清楚.
[a-zA-Z]
包含在[A-z]
里面
大寫(xiě)A
在碼表中65
Z
是90
a
是97
z
是122
所以A-z
可以表示 a-zA-Z
但是Z
到a
直接還差幾位 是[\ ]^_
等
不是數(shù)組,是二維坐標(biāo)系,只是這個(gè)坐標(biāo)系能用二維數(shù)組表示而已。
方塊的變換也就是坐標(biāo)的變換
去掉鏈接參數(shù),在代碼中加入#pragma comment(lib,"xxx.lib").
你把xxx.lib加入到你項(xiàng)目的目錄下再調(diào)試。
北大青鳥(niǎo)APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國(guó)家
北大青鳥(niǎo)中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過(guò)二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_(kāi)發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
曾工作于聯(lián)想擔(dān)任系統(tǒng)開(kāi)發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開(kāi)發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開(kāi)發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開(kāi)發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問(wèn),美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。