Boost logo

Boost Users :

Subject: [Boost-users] How to figure out if a boost class does lazy copy or not?
From: Peng Yu (pengyu.ut_at_[hidden])
Date: 2010-06-12 16:35:58


Hi,

I need to construct some container in a function and return it. I
think that some container in boost follow lazy copy sematics but some
don't.

For example, if tr1::unordered_map uses lazy copy, then I can return
an object of tr1::unordered_map. Otherwise, I should return
boost::shared_ptr<tr1::unordered_map>.

Although this information may be documented for any container that I
will use, I still think that it is still worthwhile to having my own
test case to figure it out, because it may not easy to find such
information in the document. I'm wondering if there is a generic way
to test if a container use lazy copy or not without reading the actual
implementation of the class?

-- 
Regards,
Peng

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net