作者FATCLOUD (A Cloud)
看板EE_DSnP
標題[問題] 想用 static const 製作 end 遇到的問題
時間Thu May 21 03:38:48 2009
在這次作業的 BSTree 裡面
我想要給所有的 BSTree 共用一個獨立不變的 _end node
當有人呼叫 end() 的時候就回傳它
於是就宣告了 static const BSTreeNode<T> _end;
但是奇怪的問題來了
我無法初始化他
static const BSTreeNode<T> _end = BSTreeNode<T>(..參數..);
也不能使用 BSTreeNode<T> x = &_end 這種簡單的東西
後來我改成
static const BSTreeNode<T>* _end
仍然不能用 BSTreeNode<T>* x = _end;
我想問一下
const 到底有哪些限制還能怎麼用
我覺得我想做的事很簡單
可是被各種規定擋住不知道要怎麼做 ~"~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.218.75