aboutsummaryrefslogtreecommitdiff
path: root/odb/lazy-ptr.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-03-02 12:34:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-03-02 12:34:54 +0200
commit8a9e1081c026a092c7dfb28fbd079b88850c7233 (patch)
treef44ba71ea18365b8d9c1a97c09b624a0c4d150dc /odb/lazy-ptr.ixx
parent0f25b194dcbcfa95a80284069999dd92341ce36d (diff)
Portability workarounds for incomplete C++11 support in VC++ and old GCC
Diffstat (limited to 'odb/lazy-ptr.ixx')
-rw-r--r--odb/lazy-ptr.ixx46
1 files changed, 31 insertions, 15 deletions
diff --git a/odb/lazy-ptr.ixx b/odb/lazy-ptr.ixx
index 5c67845..19150ef 100644
--- a/odb/lazy-ptr.ixx
+++ b/odb/lazy-ptr.ixx
@@ -480,9 +480,11 @@ namespace odb
lazy_unique_ptr<T, D>::
lazy_unique_ptr () {}
+#ifdef ODB_CXX11_NULLPTR
template <class T, class D>
lazy_unique_ptr<T, D>::
lazy_unique_ptr (std::nullptr_t) {}
+#endif
template <class T, class D>
lazy_unique_ptr<T, D>::
@@ -512,6 +514,7 @@ namespace odb
lazy_unique_ptr<T, D>::
lazy_unique_ptr (std::auto_ptr<T1>&& r): p_ (std::move (r)) {}
+#ifdef ODB_CXX11_NULLPTR
template <class T, class D>
lazy_unique_ptr<T, D>& lazy_unique_ptr<T, D>::
operator= (std::nullptr_t)
@@ -519,6 +522,7 @@ namespace odb
reset ();
return *this;
}
+#endif
template <class T, class D>
lazy_unique_ptr<T, D>& lazy_unique_ptr<T, D>::
@@ -560,12 +564,14 @@ namespace odb
return p_.get ();
}
+#ifdef ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR
template <class T, class D>
lazy_unique_ptr<T, D>::
operator bool() const
{
return p_ || i_;
}
+#endif
template <class T, class D>
typename lazy_unique_ptr<T, D>::pointer lazy_unique_ptr<T, D>::
@@ -787,6 +793,15 @@ namespace odb
return a.equal (b);
}
+ template <class T1, class D1, class T2, class D2>
+ inline bool
+ operator!= (const lazy_unique_ptr<T1, D1>& a,
+ const lazy_unique_ptr<T2, D2>& b)
+ {
+ return !a.equal (b);
+ }
+
+#ifdef ODB_CXX11_NULLPTR
template <class T, class D>
inline bool
operator== (const lazy_unique_ptr<T, D>& a, std::nullptr_t)
@@ -801,14 +816,6 @@ namespace odb
return !b;
}
- template <class T1, class D1, class T2, class D2>
- inline bool
- operator!= (const lazy_unique_ptr<T1, D1>& a,
- const lazy_unique_ptr<T2, D2>& b)
- {
- return !a.equal (b);
- }
-
template <class T, class D>
inline bool
operator!= (const lazy_unique_ptr<T, D>& a, std::nullptr_t)
@@ -822,6 +829,7 @@ namespace odb
{
return b;
}
+#endif
//
// lazy_shared_ptr
@@ -831,9 +839,11 @@ namespace odb
inline lazy_shared_ptr<T>::
lazy_shared_ptr () {}
+#ifdef ODB_CXX11_NULLPTR
template <class T>
inline lazy_shared_ptr<T>::
lazy_shared_ptr (std::nullptr_t) {}
+#endif
template <class T>
template <class Y>
@@ -850,6 +860,7 @@ namespace odb
inline lazy_shared_ptr<T>::
lazy_shared_ptr (Y* p, D d, A a): p_ (p, d, a) {}
+#ifdef ODB_CXX11_NULLPTR
template <class T>
template <class D>
inline lazy_shared_ptr<T>::
@@ -859,6 +870,7 @@ namespace odb
template <class D, class A>
inline lazy_shared_ptr<T>::
lazy_shared_ptr (std::nullptr_t p, D d, A a): p_ (p, d, a) {}
+#endif
template <class T>
template <class Y>
@@ -1050,12 +1062,14 @@ namespace odb
return p_.use_count ();
}
+#ifdef ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR
template <class T>
inline lazy_shared_ptr<T>::
operator bool () const
{
return p_ || i_;
}
+#endif
template <class T>
template <class Y>
@@ -1311,25 +1325,26 @@ namespace odb
return a.equal (b);
}
- template <class T>
+ template <class T, class Y>
inline bool
- operator== (const lazy_shared_ptr<T>& p, std::nullptr_t)
+ operator!= (const lazy_shared_ptr<T>& a, const lazy_shared_ptr<Y>& b)
{
- return !p;
+ return !a.equal (b);
}
+#ifdef ODB_CXX11_NULLPTR
template <class T>
inline bool
- operator== (std::nullptr_t, const lazy_shared_ptr<T>& p)
+ operator== (const lazy_shared_ptr<T>& p, std::nullptr_t)
{
return !p;
}
- template <class T, class Y>
+ template <class T>
inline bool
- operator!= (const lazy_shared_ptr<T>& a, const lazy_shared_ptr<Y>& b)
+ operator== (std::nullptr_t, const lazy_shared_ptr<T>& p)
{
- return !a.equal (b);
+ return !p;
}
template <class T>
@@ -1345,6 +1360,7 @@ namespace odb
{
return p;
}
+#endif
template <class T>
inline void