Stream Factory Interface (Question of Preference)
I seem to be stuck staring at the trees...
Background: I'm playing around with some library code for loading images and thought I'd ask what interface others would proffer. Here I have a stream 'in', say 'std::istream' for simplicity, and desire a rather direct creation interface, but find everything... lacking. (Basically, which feels right in your opinion?)
1):
Code:
smart_pointer<some_class> whatever(factory(in));
2):
Code:
smart_pointer<some_class> whatever(in >> factory());
3):
Code:
smart_pointer<some_class> whatever(0);
factory(whatever, in));
Even something as simply as '1' would be sufficient and helpful.
(Note: If I've missed an option, and I rather hope I have, then I welcome any comments regarding such other options.)
Soma