diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-03-22 15:01:29 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-03-22 15:42:44 -0400 |
commit | 5d141bce7219aeb34d3de8cfae68d643bf9a3a16 (patch) | |
tree | 9c383418e36264dac7b25aad64a55e44700fea93 /src/mongo/base/concept/convertible_to.h | |
parent | 089ce06088bbafd4c862863a8aefb4c891bdc2ba (diff) | |
download | mongo-5d141bce7219aeb34d3de8cfae68d643bf9a3a16.tar.gz |
SERVER-26025 Smart pointer with clone on copy
This clonable pointer works like a unique_ptr, but upon
copy it invokes a customizable cloning function. A `clone`
member function is used by default. There exist several
customization points.
Diffstat (limited to 'src/mongo/base/concept/convertible_to.h')
-rw-r--r-- | src/mongo/base/concept/convertible_to.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/base/concept/convertible_to.h b/src/mongo/base/concept/convertible_to.h new file mode 100644 index 00000000000..57e733418cf --- /dev/null +++ b/src/mongo/base/concept/convertible_to.h @@ -0,0 +1,14 @@ +#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 |