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: Mapping Tem...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 9540 of 9830
Post > Topic >>

Re: Mapping Templates function betweeen 2 class

by Stuart Golodetz <sgolodetz@[EMAIL PROTECTED] > Apr 24, 2008 at 03:43 PM

yogesh wrote:
> Hi,
> 
> I need to know how to solve this problem of the code ,
> 
> kindly help me if any one know this
>   given 2 cl***** A and B defined as follows
>       struct A { int a; }
>       struct B { int b; char c; }
>     the requirement is to efficiently write 2 map cl*****
>       1. class AMap
>      It should have member functions similar to below
>        add (const std::string name, A*)
>        A* get (const std::string name)
>        remove(const std::string name)
>       2. class BMap
>      It should have member functions similar to below
>        add (const std::string name, B*)
>        B* get (const std::string name)
>        remove(const std::string name)
>     Note that in the above add/get/remove functions, I have
> deliberately not provided the correct signatures as that is what you
> need to create.
>     Add a main routine that exercises all the above functions
>     no extra libs like glib should be used; STL may be used
> 
> 
> can any one guess what this

Yes, he wants you to write two cl***** which map strings to A* and B* 
respectively. I don't think the way he's specified it is especially 
precise, and I'm not sure A* and B* are especially good choices for a 
value type (who owns the memory pointed to? who should ultimately 
delete/free it?), but those are things you can point out in your answer. 
It's also worth asking what he means by "efficiently write". Should the 
writing be efficient, or the code? There's not always a trade-off 
involved, but there can be.

Regards,
Stu

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 7 Posts in Topic:
Mapping Templates function betweeen 2 class
yogesh <yogeshkumark@[  2008-04-24 01:04:38 
Re: Mapping Templates function betweeen 2 class
Nicola Musatti <nicola  2008-04-24 15:18:45 
Re: Mapping Templates function betweeen 2 class
"Alf P. Steinbach&qu  2008-04-24 15:43:21 
Re: Mapping Templates function betweeen 2 class
red floyd <no.spam@[EM  2008-04-24 15:43:19 
Re: Mapping Templates function betweeen 2 class
Stuart Golodetz <sgolo  2008-04-24 15:43:20 
Re: Mapping Templates function betweeen 2 class
Alex Shulgin <alex.shu  2008-04-25 03:41:56 
Re: Mapping Templates function betweeen 2 class
nickf3 <nickf3@[EMAIL   2008-04-25 03:41:25 

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:38:47 CDT 2008.