summaryrefslogtreecommitdiff
path: root/src/mongo/base/concept
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/base/concept')
-rw-r--r--src/mongo/base/concept/assignable.h8
-rw-r--r--src/mongo/base/concept/clonable.h20
-rw-r--r--src/mongo/base/concept/clone_factory.h22
-rw-r--r--src/mongo/base/concept/constructible.h49
-rw-r--r--src/mongo/base/concept/convertible_to.h16
-rw-r--r--src/mongo/base/concept/copy_assignable.h20
-rw-r--r--src/mongo/base/concept/copy_constructible.h16
-rw-r--r--src/mongo/base/concept/unique_ptr.h50
8 files changed, 100 insertions, 101 deletions
diff --git a/src/mongo/base/concept/assignable.h b/src/mongo/base/concept/assignable.h
index 15fcc555b01..0c3e2d68e59 100644
--- a/src/mongo/base/concept/assignable.h
+++ b/src/mongo/base/concept/assignable.h
@@ -33,9 +33,9 @@
namespace mongo {
namespace concept {
-/*!
- * The Assignable concept models a type which can be copy assigned and copy constructed.
- */
-struct Assignable : CopyConstructible, CopyAssignable {};
+ /*!
+ * 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
index 63cdceec353..d658b0e5442 100644
--- a/src/mongo/base/concept/clonable.h
+++ b/src/mongo/base/concept/clonable.h
@@ -33,16 +33,16 @@
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;
+ /*!
+ * 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;
-};
+ /*! 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
index 5db13c17de9..d263311b79d 100644
--- a/src/mongo/base/concept/clone_factory.h
+++ b/src/mongo/base/concept/clone_factory.h
@@ -34,16 +34,16 @@
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;
-};
+ /*!
+ * 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
index b0f6d81adc5..f725c952d36 100644
--- a/src/mongo/base/concept/constructible.h
+++ b/src/mongo/base/concept/constructible.h
@@ -35,32 +35,31 @@
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 {};
+ /**
+ * 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 {};
+ 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 {};
+ /**
+ * 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
index 7cf7e86a73f..9f9187126d5 100644
--- a/src/mongo/base/concept/convertible_to.h
+++ b/src/mongo/base/concept/convertible_to.h
@@ -30,13 +30,13 @@
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();
-}
+ /**
+ * 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
index e89d4699e87..580325564e0 100644
--- a/src/mongo/base/concept/copy_assignable.h
+++ b/src/mongo/base/concept/copy_assignable.h
@@ -30,17 +30,17 @@
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`.
+ * The CopyAssignable concept models a type which can be copy assigned.
+ *
+ * The expression: `copyAssignable= copyAssignable` should be valid.
*/
- CopyAssignable& operator=(const CopyAssignable&) &;
-};
+ 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
index 68d8cab494a..689f8e44b71 100644
--- a/src/mongo/base/concept/copy_constructible.h
+++ b/src/mongo/base/concept/copy_constructible.h
@@ -30,13 +30,13 @@
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&);
-};
+ /**
+ * 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
index e014a6d8a14..b7518963c54 100644
--- a/src/mongo/base/concept/unique_ptr.h
+++ b/src/mongo/base/concept/unique_ptr.h
@@ -32,38 +32,38 @@
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;
+ /**
+ * 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&& p);
+ UniquePtr& operator=(UniquePtr&& p);
- UniquePtr();
- UniquePtr(T* p);
+ UniquePtr();
+ UniquePtr(T* p);
- ConvertibleTo<T*> operator->() const;
- T& operator*() const;
+ ConvertibleTo<T*> operator->() const;
+ T& operator*() const;
- explicit operator bool() const;
+ explicit operator bool() const;
- ConvertibleTo<T*> get() const;
+ ConvertibleTo<T*> get() const;
- void reset() noexcept;
- void reset(ConvertibleTo<T*>);
-};
+ 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 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);
+ /*! A `UniquePtr` object must be inequality comparable. */
+ template <typename T>
+ bool operator!=(const UniquePtr<T>& lhs, const UniquePtr<T>& rhs);
} // namespace concept
} // namespace mongo