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 5 of 5 Topic 9583 of 9830
Post > Topic >>

Re: template depth problem

by Francis Glassborow <francis.glassborow@[EMAIL PROTECTED] > May 9, 2008 at 09:23 AM

Venkat wrote:
> Trying to have the following usage; however, gcc is not liking.
When seeking help it is always desirable that you give us as much
information as possible. At the very least indicate which line gcc was
rejecting and if possible the error message that it gave. I know that
error messages are sometimes very lengthy where templates are concerned
but it is usually possible identify what is being complained about at
least in general.
> 
> #include <boost/smart_ptr.hpp>
> 
> namespace xyz {
> class elem {
> public:
>      typedef boost::shared_ptr<elem>     elem_sptr;
> };
> 
That just renames boost::shared pointer in the scope of class elem.
elem_sptr will not be visible anywhere outside this class scope. Why did
you encapsulate the typedef in a class?

> }
> 
> #include <map>
> 
> namespace abc {
> template <typename ObjectType>
> class BaseContainer
> {
>     typedef std::map<int, ObjectType::elem_sptr> Container;
> 
>     // tried this too
>     //typedef std::map<int, boost::shared_ptr<ObjectType> > Container;
> 
>     typedef Container::iterator iterator;
> 
>      Container  c;
> };
> 
I think you are trying too much with all those typedefs
> }
> 
> void main()
and of course, this is a popular error. the Standard requires main to
return an int.

> {
>     abc::BaseContainer<xyz::elem>  elem_container;

so what error did gcc throw up? and was it the same one for both your
attempts?
> }
> 
> Any thoughts on the usage?
> 
> Thanks
> Venkat
> 

-- 
Note that robinton.demon.co.uk addresses are no longer valid.

      [ 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 Fri Jul 25 15:46:15 CDT 2008.