Rename Box value_type to element_type

This matches the member type naming on unique_ptr.
https://en.cppreference.com/w/cpp/memory/unique_ptr#Member_types
It appears value_type is for a member type of a container or iterator
while element_type is for the target of a smart pointer.
This commit is contained in:
David Tolnay 2020-12-27 19:35:21 -08:00
parent e0d2227b6f
commit e47a4d94d0
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 5 additions and 2 deletions

View File

@ -13,7 +13,7 @@
template <typename T>
class Box final {
public:
using value_type = T;
using element_type = T;
using const_pointer =
typename std::add_pointer<typename std::add_const<T>::type>::type;
using pointer = typename std::add_pointer<T>::type;

View File

@ -222,7 +222,7 @@ private:
template <typename T>
class Box final {
public:
using value_type = T;
using element_type = T;
using const_pointer =
typename std::add_pointer<typename std::add_const<T>::type>::type;
using pointer = typename std::add_pointer<T>::type;
@ -252,6 +252,9 @@ public:
T *into_raw() noexcept;
// Deprecated.
using value_type = element_type;
private:
class uninit;
class allocation;