aboutsummaryrefslogtreecommitdiff
path: root/odb/tr1/wrapper-traits.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/tr1/wrapper-traits.hxx')
-rw-r--r--odb/tr1/wrapper-traits.hxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/odb/tr1/wrapper-traits.hxx b/odb/tr1/wrapper-traits.hxx
index e65e2d7..f8a9f6c 100644
--- a/odb/tr1/wrapper-traits.hxx
+++ b/odb/tr1/wrapper-traits.hxx
@@ -26,6 +26,12 @@ namespace odb
typedef T wrapped_type;
typedef std::tr1::shared_ptr<T> wrapper_type;
+ // T can be const.
+ //
+ typedef
+ typename details::meta::remove_const<T>::result
+ unrestricted_wrapped_type;
+
static const bool null_handler = true;
static const bool null_default = false;
@@ -47,13 +53,13 @@ namespace odb
return *p;
}
- static wrapped_type&
+ static unrestricted_wrapped_type&
set_ref (wrapper_type& p)
{
if (!p)
- p.reset (new wrapped_type);
+ p.reset (new unrestricted_wrapped_type);
- return *p;
+ return const_cast<unrestricted_wrapped_type&> (*p);
}
};
}