From 6e9f54c33dd67b629ec2a31cadd6815a651f70f5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 29 Feb 2012 17:50:01 +0200 Subject: Use move instead of copy in container traits if C++11 is available --- odb/std-map-traits.hxx | 10 ++++++++++ odb/std-set-traits.hxx | 10 ++++++++++ 2 files changed, 20 insertions(+) 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 #include +#include // std::move #include +#include // 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 #include +#include // std::move #include +#include // 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 } } -- cgit v1.1