C++ intricacies

Hello. I have two questions:
1) Are nested classes legal C++03, and is there a limit to the nesting depth?
class A {class B {class C {/*... */};};};

2) In template classes' member functions, does the parameter need to be specified (from what I tested, it's deduced as the default if unspecified, but I want to know if that's standard behavior).
1
2
3
4
5
6
template <typename T>
class A {
public:
    A& operator=(const A& a) {} // or...
    A<T>& operator=(const A<T>& a) {}
};


Thanks.
1) Yes. (they were added to C++ in 1989, for useless trivia's sake) The limit is not specified.

2) It does not need to be specified.
Quoting C++03 14.6.1[temp.local]/1: "The injected class-name can be used with or without a template-argument-list. When it is used without a template argument-list, it is equivalent to the injected-class-name followed by the template-parameters of the class template enclosed in <>."
Last edited on
There is a recommendation in the C++ Standard that

"— Levels of nested class definitions in a single member-specification [256]."
Topic archived. No new replies allowed.