[Serialization] Constructor for polymorphic archives
I have a set of my own Boost.Serialization archives (e.g. [1]) that I wish to write polymorphic variants of. I have tried to follow the blueprint from polymorphic_text_iarchive, which inherits from polymorphic_iarchive_route. The problem is that the constructor of my archives takes iterators (begin and end) as arguments, but the polymorphic_iarchive_route constructor expects a std::stream argument. Is there any workaround for this? [1] http://sourceforge.net/p/protoc/code/ci/master/tree/include/protoc/transenc/...
On 6/24/2013 11:18 AM, Bjorn Reese wrote:
I have a set of my own Boost.Serialization archives (e.g. [1]) that I wish to write polymorphic variants of.
I have tried to follow the blueprint from polymorphic_text_iarchive, which inherits from polymorphic_iarchive_route.
The problem is that the constructor of my archives takes iterators (begin and end) as arguments, but the polymorphic_iarchive_route constructor expects a std::stream argument. Is there any workaround for this?
My first thought would be to use boost::iostream to create the i/o streams with an appropriate source/sink wrapping your iterator usage. Jeff
On 06/24/2013 06:42 PM, Jeff Flinn wrote:
My first thought would be to use boost::iostream to create the i/o streams with an appropriate source/sink wrapping your iterator usage.
Thanks Jeff. I got something like this working, but as both the application and my archives are using iterators, I ended up with too much wrapping to accommodate polymorphic_iarchive_route. So I am probably going to write my own (polymorphic_iarchive_route is just a wrapper itself.)
Bjorn Reese wrote:
On 06/24/2013 06:42 PM, Jeff Flinn wrote:
My first thought would be to use boost::iostream to create the i/o streams with an appropriate source/sink wrapping your iterator usage.
Thanks Jeff. I got something like this working, but as both the application and my archives are using iterators, I ended up with too much wrapping to accommodate polymorphic_iarchive_route. So I am probably going to write my own (polymorphic_iarchive_route is just a wrapper itself.)
I looked at the original post and the code. My initial reaction was that polymorphic_iarchive_route should really be refactored to take as an argument to the constructor a an already constructed non-polymorphic archive. Then I got distracted on other stuff. Maybe you want to think about this some more and post a suggestion as a trac item so we don't forget it. Robert Ramey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
On 06/27/2013 07:30 PM, Robert Ramey wrote:
I looked at the original post and the code. My initial reaction was that polymorphic_iarchive_route should really be refactored to take as an argument to the constructor a an already constructed non-polymorphic archive. Then I got distracted on other stuff. Maybe you want to think about this some more and post a suggestion as a trac item so we don't forget it.
participants (3)
-
Bjorn Reese
-
Jeff Flinn
-
Robert Ramey