Homemade STL - how to make "specific" constructor and istream>> operator

B

Bubba

Greetings to all,

I created my own parameterized class 'set', here's the code:

http://goo.gl/vrkpC

I implemented constructors, destructor, copy control, assignment operators
(both simple and complex), several set operators (intersection, union,
difference, complement), adding and subtracting members of set, dynamic
memory allocation, etc...

Now, I have two questions:

i) how to make constructor that would "convert" STL (vectors, lists...) to
my set?
ii) I can't figgure out how exactly should operator>> look like. << was
easy enough, but input bothers me.

Thanks for any clue.

Best regards,

Bubba
 
J

Jorgen Grahn

Greetings to all,

I created my own parameterized class 'set', here's the code:

http://goo.gl/vrkpC

Haven't looked at it.
I implemented constructors, destructor, copy control, assignment operators
(both simple and complex), several set operators (intersection, union,
difference, complement), adding and subtracting members of set, dynamic
memory allocation, etc...

Now, I have two questions:

i) how to make constructor that would "convert" STL (vectors, lists...) to
my set?

The same way as /they/ do -- a constructor which takes two iterators.
ii) I can't figgure out how exactly should operator>> look like. << was
easy enough, but input bothers me.

If you're aiming for something like the STL containers, don't bother.
Stream input would be useless to most users anyway -- what are the
chances that their external representation matches the one you choose?

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top