by ciesizdz@[EMAIL PROTECTED]
May 9, 2008 at 09:24 AM
> Trying to have the following usage; however, gcc is not liking.
>
> ...
>
> Any thoughts on the usage?
Gcc is not even compiling this code so it is rather obvious it refuses
to link. ;)
I can spot 2 problems in this code. 1st of all -- your main function.
It should
always return an integer, not void. Another mistake is missing
typename keyword.
ObjectType::elem_sprt and Container::iterator depend on ObjectType
which is
template parameter. This is why you need to precede its definition
with typename.
Here's what needs to be changed:
namespace abc {
template <typename ObjectType>
class BaseContainer {
typedef std::map<int, typename ObjectType::elem_sptr> Container;
typedef typename Container::iterator iterator;
Container c;
};
}
int main() {
abc::BaseContainer<xyz::elem> elem_container;
return 0;
}
Regards,
Zdzislaw Ciesielski
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]