diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-02-29 17:50:01 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-02-29 17:50:01 +0200 |
commit | 6e9f54c33dd67b629ec2a31cadd6815a651f70f5 (patch) | |
tree | 2f54ab9b409afc6017fc87210ab53ab642b15840 | |
parent | d8bfbd451d14b7891b43e88541704f69fe8ccd33 (diff) |
Use move instead of copy in container traits if C++11 is available
-rw-r--r-- | odb/std-map-traits.hxx | 10 | ||||
-rw-r--r-- | odb/std-set-traits.hxx | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/odb/std-map-traits.hxx b/odb/std-map-traits.hxx index dcaba3f..a30b13e 100644 --- a/odb/std-map-traits.hxx +++ b/odb/std-map-traits.hxx @@ -8,8 +8,10 @@ #include <odb/pre.hxx> #include <map> +#include <utility> // std::move #include <odb/container-traits.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 namespace odb { @@ -46,7 +48,11 @@ namespace odb key_type k; value_type v; more = f.load_all (k, v); +#ifdef ODB_CXX11 + c.insert (pair_type (std::move (k), std::move (v))); +#else c.insert (pair_type (k, v)); +#endif } } @@ -104,7 +110,11 @@ namespace odb key_type k; value_type v; more = f.load_all (k, v); +#ifdef ODB_CXX11 + c.insert (pair_type (std::move (k), std::move (v))); +#else c.insert (pair_type (k, v)); +#endif } } diff --git a/odb/std-set-traits.hxx b/odb/std-set-traits.hxx index a4a5923..e6b4853 100644 --- a/odb/std-set-traits.hxx +++ b/odb/std-set-traits.hxx @@ -8,8 +8,10 @@ #include <odb/pre.hxx> #include <set> +#include <utility> // std::move #include <odb/container-traits.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 namespace odb { @@ -42,7 +44,11 @@ namespace odb { value_type v; more = f.load_all (v); +#ifdef ODB_CXX11 + c.insert (std::move (v)); +#else c.insert (v); +#endif } } @@ -96,7 +102,11 @@ namespace odb { value_type v; more = f.load_all (v); +#ifdef ODB_CXX11 + c.insert (std::move (v)); +#else c.insert (v); +#endif } } |