|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - problem with enums in namespaces, and operator-> in templates
Hi,
I tried out dm and encountered two problems.
1.) Declaration of enum constants in namespaces:
Example:
namespace storage {
enum type
{
dumb,
place,
pool,
heap
};
}
If i try to explicitely use these constants, like
unsigned int test = storage::heap;
-> error: namespace storage has no member heap
(while implicitely using them works ok, like
enum storage::type test = heap;
-> ok
)
2.) Problems with overriden operator->() in templates
If i have overriden the -> operator in a template class, and
i instantiate it with something where -> doesn't makes sense, i get an error
(even if i don't use the -> operator).
The dm compiler should only instantiate those templates which are really
needed, this would be more convenient. For example the gnu gcc and
visual c++ 7.0 doesn't complain, if you don't use the template
operator->()
class Test {
public:
double m;
}
smartptr<Test> p1;
p->m = 0.3; // ok
smartptr<int> p2; // ok if you don't use '->'
Best regards
Norbert Irmer
Nov 13 2002
8irmer informatik.uni-hamburg.de wrote:Hi, I tried out dm and encountered two problems. 2.) Problems with overriden operator->() in templates If i have overriden the -> operator in a template class, and i instantiate it with something where -> doesn't makes sense, i get an error (even if i don't use the -> operator). The dm compiler should only instantiate those templates which are really needed, this would be more convenient. For example the gnu gcc and visual c++ 7.0 doesn't complain, if you don't use the template operator->() Nov 13 2002
|