作者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