Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: template de...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 9583 of 9823
Post > Topic >>

Re: template depth problem

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! ]
 




 5 Posts in Topic:
template depth problem
Venkat <swara101@[EMAI  2008-05-08 21:30:31 
Re: template depth problem
Dan Barbus <dan.barbus  2008-05-09 09:28:36 
Re: template depth problem
David Pol <david@[EMAI  2008-05-09 09:24:25 
Re: template depth problem
ciesizdz@[EMAIL PROTECTED  2008-05-09 09:24:12 
Re: template depth problem
Francis Glassborow <fr  2008-05-09 09:23:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 1:46:00 CDT 2008.