summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/move.h
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-19 18:19:39 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-19 18:19:39 +0000
commite56043cd2c207982e812ce6fcecb7353dea58363 (patch)
tree01a6f37ad5a9ae6b18bdc20f052b04e19b4255c0 /libstdc++-v3/include/bits/move.h
parent2e02a1a4548f2ee1ea519c88e68b20621ad16fcc (diff)
downloadgcc-e56043cd2c207982e812ce6fcecb7353dea58363.tar.gz
2010-09-19 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 164348, with some improvements in gcc/melt-runtime.[ch] 2010-09-19 Basile Starynkevitch <basile@starynkevitch.net> [[merged with trunk rev.164348, so improved MELT runtime!]] * gcc/melt-runtime.h: improved comments. (melt_debug_garbcoll, melt_debuggc_eprintf): Moved from melt-runtime.c. (melt_obmag_string): New declaration. (struct meltobject_st, struct meltclosure_st, struct meltroutine_st, struct meltmixbigint_st, struct meltstring_st): using GTY variable_size and @@MELTGTY@@ comment. (melt_mark_special): added debug print. * gcc/melt-runtime.c: Improved comments. Include bversion.h, realmpfr.h, gimple-pretty-print.h. (ggc_force_collect) Declared external. (melt_forward_counter): Added. (melt_obmag_string): New function. (melt_alptr_1, melt_alptr_2, melt_break_alptr_1_at) (melt_break_alptr_2_at, melt_break_alptr_1,melt_break_alptr_1) (melt_allocate_young_gc_zone, melt_free_young_gc_zone): New. (delete_special, meltgc_make_special): Improved debug printf and use melt_break_alptr_1... (ggc_alloc_*) macros defined for backport to GCC 4.5 (melt_forwarded_copy): Don't clear the new destination zone in old GGC heap. (meltgc_add_out_raw_len): Use ggc_alloc_atomic. (meltgc_raw_new_mappointers, meltgc_raw_put_mappointers) (meltgc_raw_remove_mappointers): Corrected length argument to ggc_alloc_cleared_vec_entrypointermelt_st. (melt_really_initialize): Call melt_allocate_young_gc_zone. (melt_initialize): Set flag_plugin_added. (melt_val2passflag): TODO_verify_loops only in GCC 4.5 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@164424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/move.h')
-rw-r--r--libstdc++-v3/include/bits/move.h47
1 files changed, 32 insertions, 15 deletions
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 91754814d8b..9329cb491db 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -1,6 +1,6 @@
// Move, forward and identity for C++0x + swap -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -31,38 +31,43 @@
#define _MOVE_H 1
#include <bits/c++config.h>
-#include <cstddef>
#include <bits/concept_check.h>
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <type_traits> // Brings in std::declval too.
-
_GLIBCXX_BEGIN_NAMESPACE(std)
- /// identity
+ // Used, in C++03 mode too, by allocators, etc.
template<typename _Tp>
- struct identity
+ inline _Tp*
+ __addressof(_Tp& __r)
{
- typedef _Tp type;
- };
+ return reinterpret_cast<_Tp*>
+ (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <type_traits> // Brings in std::declval too.
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
/// forward (as per N2835)
/// Forward lvalues as rvalues.
template<typename _Tp>
inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
- forward(typename std::identity<_Tp>::type& __t)
+ forward(typename std::common_type<_Tp>::type& __t)
{ return static_cast<_Tp&&>(__t); }
/// Forward rvalues as rvalues.
template<typename _Tp>
inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
- forward(typename std::identity<_Tp>::type&& __t)
+ forward(typename std::common_type<_Tp>::type&& __t)
{ return static_cast<_Tp&&>(__t); }
// Forward lvalues as lvalues.
template<typename _Tp>
inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
- forward(typename std::identity<_Tp>::type __t)
+ forward(typename std::common_type<_Tp>::type __t)
{ return __t; }
// Prevent forwarding rvalues as const lvalues.
@@ -81,14 +86,26 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
move(_Tp&& __t)
{ return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
- /// declval, defined in <type_traits>.
+ /// declval, from type_traits.
+
+ /**
+ * @brief Returns the actual address of the object or function
+ * referenced by r, even in the presence of an overloaded
+ * operator&.
+ * @param __r Reference to an object or function.
+ * @return The actual address.
+ */
+ template<typename _Tp>
+ inline _Tp*
+ addressof(_Tp& __r)
+ { return std::__addressof(__r); }
_GLIBCXX_END_NAMESPACE
-#define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
+#define _GLIBCXX_MOVE(__val) std::move(__val)
#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
#else
-#define _GLIBCXX_MOVE(_Tp) (_Tp)
+#define _GLIBCXX_MOVE(__val) (__val)
#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
#endif