mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
MSVC fixes.
[SVN r13476]
This commit is contained in:
parent
6156f0d302
commit
339937380e
@ -12,7 +12,7 @@
|
|||||||
// ref.hpp - ref/cref, useful helper functions
|
// ref.hpp - ref/cref, useful helper functions
|
||||||
//
|
//
|
||||||
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
|
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
|
||||||
// Copyright (C) 2001 Peter Dimov
|
// Copyright (C) 2001, 2002 Peter Dimov
|
||||||
// Copyright (C) 2002 David Abrahams
|
// Copyright (C) 2002 David Abrahams
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Permission to copy, use, modify, sell and distribute this software
|
||||||
@ -31,8 +31,16 @@ template<class T> class reference_wrapper
|
|||||||
public:
|
public:
|
||||||
typedef T type;
|
typedef T type;
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||||
|
|
||||||
|
explicit reference_wrapper(T& t): t_(&t) {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
explicit reference_wrapper(T& t): t_(addressof(t)) {}
|
explicit reference_wrapper(T& t): t_(addressof(t)) {}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
operator T& () const { return *t_; }
|
operator T& () const { return *t_; }
|
||||||
|
|
||||||
T& get() const { return *t_; }
|
T& get() const { return *t_; }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
||||||
// Doug Gregor (gregod@cs.rpi.edu)
|
// Doug Gregor (gregod@cs.rpi.edu)
|
||||||
|
// Peter Dimov
|
||||||
//
|
//
|
||||||
// Permission to copy, use, sell and distribute this software is granted
|
// Permission to copy, use, sell and distribute this software is granted
|
||||||
// provided this copyright notice appears in all copies.
|
// provided this copyright notice appears in all copies.
|
||||||
@ -17,11 +18,12 @@
|
|||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template <typename T>
|
// Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
|
||||||
inline T* addressof(T& v)
|
|
||||||
|
template <typename T> T* addressof(T& v)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<T*>(
|
return reinterpret_cast<T*>(
|
||||||
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
|
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user