diff options
author | Randolph Tan <randolph@10gen.com> | 2017-03-22 17:19:42 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2017-03-22 17:19:42 -0400 |
commit | 7b4770c1dbbc2a264a10f4fcfc87025ce832b680 (patch) | |
tree | a0e9e473e65bd8371ef09b47afbd87897a0f0ca1 /src/mongo/base/concept | |
parent | 6c5938b9fcedf740f292533ea1c637fd0eccf9f4 (diff) | |
download | mongo-7b4770c1dbbc2a264a10f4fcfc87025ce832b680.tar.gz |
Revert "SERVER-26025 Smart pointer with clone on copy"
This reverts commit 5d141bce7219aeb34d3de8cfae68d643bf9a3a16.
Diffstat (limited to 'src/mongo/base/concept')
-rw-r--r-- | src/mongo/base/concept/README | 5 | ||||
-rw-r--r-- | src/mongo/base/concept/assignable.h | 13 | ||||
-rw-r--r-- | src/mongo/base/concept/clonable.h | 20 | ||||
-rw-r--r-- | src/mongo/base/concept/clone_factory.h | 21 | ||||
-rw-r--r-- | src/mongo/base/concept/constructible.h | 38 | ||||
-rw-r--r-- | src/mongo/base/concept/convertible_to.h | 14 | ||||
-rw-r--r-- | src/mongo/base/concept/copy_assignable.h | 18 | ||||
-rw-r--r-- | src/mongo/base/concept/copy_constructible.h | 14 | ||||
-rw-r--r-- | src/mongo/base/concept/unique_ptr.h | 41 |
9 files changed, 0 insertions, 184 deletions
diff --git a/src/mongo/base/concept/README b/src/mongo/base/concept/README deleted file mode 100644 index bc2c74fabe4..00000000000 --- a/src/mongo/base/concept/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains a number of C++ headers which describe concepts for -C++ types used by and with the Mongo library. These headers do not describe -instantiable types, but instead are used to concisely describe models of C++ -type concepts. When C++ grows a proper `Concepts` feature, these files can be -converted to proper concepts. diff --git a/src/mongo/base/concept/assignable.h b/src/mongo/base/concept/assignable.h deleted file mode 100644 index 8cf3f0e9ab5..00000000000 --- a/src/mongo/base/concept/assignable.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "mongo/base/concept/copy_assignable.h" -#include "mongo/base/concept/copy_constructible.h" - -namespace mongo { -namespace concept { -/*! - * The Assignable concept models a type which can be copy assigned and copy constructed. - */ -struct Assignable : CopyConstructible, CopyAssignable {}; -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/clonable.h b/src/mongo/base/concept/clonable.h deleted file mode 100644 index 96354333c0d..00000000000 --- a/src/mongo/base/concept/clonable.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "mongo/base/concept/constructible.h" -#include "mongo/base/concept/unique_ptr.h" - -namespace mongo { -namespace concept { -/*! - * Objects conforming to the Clonable concept can be dynamically copied, using `this->clone()`. - * The Clonable concept does not specify the return type of the `clone()` function. - */ -struct Clonable { - /*! Clonable objects must be safe to destroy, by pointer. */ - virtual ~Clonable() noexcept = 0; - - /*! Clonable objects can be cloned without knowing the actual dynamic type. */ - Constructible<UniquePtr<Clonable>> clone() const; -}; -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/clone_factory.h b/src/mongo/base/concept/clone_factory.h deleted file mode 100644 index 17e7be07cc3..00000000000 --- a/src/mongo/base/concept/clone_factory.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "mongo/base/concept/assignable.h" -#include "mongo/base/concept/constructible.h" -#include "mongo/base/concept/unique_ptr.h" - -namespace mongo { -namespace concept { -/*! - * Objects conforming to the `CloneFactory` concept are function-like constructs which return - * objects that are dynamically allocated copies of their inputs. - * These copies can be made without knowing the actual dynamic type. The `CloneFactory` type itself - * must be `Assignable`, in that it can be used with automatically generated copy constructors and - * copy assignment operators. - */ -template <typename T> -struct CloneFactory : Assignable { - Constructible<UniquePtr<T>> operator()(const T*) const; -}; -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/constructible.h b/src/mongo/base/concept/constructible.h deleted file mode 100644 index b6e5211e6f1..00000000000 --- a/src/mongo/base/concept/constructible.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include <type_traits> - -#include "mongo/stdx/type_traits.h" - -namespace mongo { -namespace concept { - -/** - * The Constructable trait indicates whether `T` is constructible from `Constructible`. - * - * RETURNS: true if `T{ std::declval< Constructible >() }` is a valid expression and false - * otherwise. - */ -template <typename T, typename Constructible, typename = void> -struct is_constructible : std::false_type {}; - -template <typename T, typename Constructible> -struct is_constructible<T, - Constructible, - stdx::void_t<decltype(T{std::declval<Constructible<T>>()})>> - : std::true_type {}; - -/** - * The Constructable concept models a type which can be passed to a single-argument constructor of - * `T`. - * This is not possible to describe in the type `Constructible`. - * - * The expression: `T{ std::declval< Constructible< T > >() }` should be valid. - * - * This concept is more broadly applicable than `ConvertibleTo`. `ConvertibleTo` uses implicit - * conversion, whereas `Constructible` uses direct construction. - */ -template <typename T> -struct Constructible {}; -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/convertible_to.h b/src/mongo/base/concept/convertible_to.h deleted file mode 100644 index 57e733418cf..00000000000 --- a/src/mongo/base/concept/convertible_to.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace mongo { -namespace concept { -/** - * The ConvertibleTo concept models a type which can be converted implicitly into a `T`. - * The code: `T x; x= ConvertibleTo< T >{};` should be valid. - */ -template <typename T> -struct ConvertibleTo { - operator T(); -} -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/copy_assignable.h b/src/mongo/base/concept/copy_assignable.h deleted file mode 100644 index 2b29e96eb82..00000000000 --- a/src/mongo/base/concept/copy_assignable.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -namespace mongo { -namespace concept { -/** - * The CopyAssignable concept models a type which can be copy assigned. - * - * The expression: `copyAssignable= copyAssignable` should be valid. - */ -struct CopyAssignable { - /** - * The copy assignment operator is required by `CopyAssignable`. - * NOTE: Copy Assignment is only required on lvalue targets of `CopyAssignable`. - */ - CopyAssignable& operator=(const CopyAssignable&) &; -}; -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/copy_constructible.h b/src/mongo/base/concept/copy_constructible.h deleted file mode 100644 index c96856cc485..00000000000 --- a/src/mongo/base/concept/copy_constructible.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace mongo { -namespace concept { -/** - * The CopyConstructable concept models a type which can be copy constructed. - * - * The expression: `CopyConstructible{ copyConstructible }` should be valid. - */ -struct CopyConstructible { - CopyConstructible(const CopyConstructible&); -}; -} // namespace concept -} // namespace mongo diff --git a/src/mongo/base/concept/unique_ptr.h b/src/mongo/base/concept/unique_ptr.h deleted file mode 100644 index 1edd552a93f..00000000000 --- a/src/mongo/base/concept/unique_ptr.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "mongo/base/concept/convertible_to.h" - -namespace mongo { -namespace concept { -/** - * The `UniquePtr` Concept models a movable owning pointer of an object. - * `std::unique_ptr< T >` is a model of `mongo::concept::UniquePtr< T >`. - */ -template <typename T> -struct UniquePtr { - /** The `UniquePtr< T >` must retire its pointer to `T` on destruction. */ - ~UniquePtr() noexcept; - - UniquePtr(UniquePtr&& p); - UniquePtr& operator=(UniquePtr&& p); - - UniquePtr(); - UniquePtr(T* p); - - ConvertibleTo<T*> operator->() const; - T& operator*() const; - - explicit operator bool() const; - - ConvertibleTo<T*> get() const; - - void reset() noexcept; - void reset(ConvertibleTo<T*>); -}; - -/*! A `UniquePtr` object must be equality comparable. */ -template <typename T> -bool operator==(const UniquePtr<T>& lhs, const UniquePtr<T>& rhs); - -/*! A `UniquePtr` object must be inequality comparable. */ -template <typename T> -bool operator!=(const UniquePtr<T>& lhs, const UniquePtr<T>& rhs); -} // namespace concept -} // namespace mongo |