diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2014-09-08 16:22:22 -0700 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2014-09-08 17:51:31 -0700 |
commit | d9ff7226613014056c9edd79a68dc5af939107a0 (patch) | |
tree | 9866b50193d3886937a4ea13a5c3f88de7600f20 /libc/private | |
parent | 3c3624f3df14590e7213d35c3b39a0a11c7d2d34 (diff) | |
download | bionic-d9ff7226613014056c9edd79a68dc5af939107a0.tar.gz bionic-d9ff7226613014056c9edd79a68dc5af939107a0.tar.bz2 bionic-d9ff7226613014056c9edd79a68dc5af939107a0.zip |
Refactoring: C++11 style DISABLE_ bionic marcos
Enable the -std=gnu++11 flag for libstdc++ static and
dynamic libs.
ScopeGuard uses DISABLE_ macros instead of '= delete';
Change-Id: I07e21b306f95fffd49345f7fa136cfdac61e0225
Diffstat (limited to 'libc/private')
-rw-r--r-- | libc/private/ScopeGuard.h | 14 | ||||
-rw-r--r-- | libc/private/bionic_macros.h | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/libc/private/ScopeGuard.h b/libc/private/ScopeGuard.h index 183e322f7..d5a9235d1 100644 --- a/libc/private/ScopeGuard.h +++ b/libc/private/ScopeGuard.h @@ -14,8 +14,10 @@ * limitations under the License. */ -#ifndef SCOPE_GUARD_H -#define SCOPE_GUARD_H +#ifndef _SCOPE_GUARD_H +#define _SCOPE_GUARD_H + +#include "private/bionic_macros.h" // TODO: include explicit std::move when it becomes available template<typename F> @@ -40,14 +42,12 @@ class ScopeGuard { F f_; bool active_; - ScopeGuard() = delete; - ScopeGuard(const ScopeGuard&) = delete; - ScopeGuard& operator=(const ScopeGuard&) = delete; + DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeGuard); }; template<typename T> -ScopeGuard<T> create_scope_guard(T f) { +ScopeGuard<T> make_scope_guard(T f) { return ScopeGuard<T>(f); } -#endif // SCOPE_GUARD_H +#endif // _SCOPE_GUARD_H diff --git a/libc/private/bionic_macros.h b/libc/private/bionic_macros.h index 61794bd54..491b3ace0 100644 --- a/libc/private/bionic_macros.h +++ b/libc/private/bionic_macros.h @@ -20,8 +20,8 @@ // DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions. // It goes in the private: declarations in a class. #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) + TypeName(const TypeName&) = delete; \ + void operator=(const TypeName&) = delete // A macro to disallow all the implicit constructors, namely the // default constructor, copy constructor and operator= functions. @@ -30,7 +30,7 @@ // that wants to prevent anyone from instantiating it. This is // especially useful for classes containing only static methods. #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName(); \ + TypeName() = delete; \ DISALLOW_COPY_AND_ASSIGN(TypeName) #define BIONIC_ALIGN(value, alignment) \ |