Skip to content

Commit b993292

Browse files
committed
avoid using a not required alias
1 parent 9068d54 commit b993292

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

include/reactor-cpp/value_ptr.hh

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ class ImmutableValuePtr;
1818

1919
template <class T>
2020
class MutableValuePtr {
21-
public:
22-
using type = T;
23-
2421
private:
25-
std::unique_ptr<type> internal_ptr;
22+
std::unique_ptr<T> internal_ptr;
2623

27-
explicit MutableValuePtr(type* ptr) : internal_ptr(ptr) {}
24+
explicit MutableValuePtr(T* ptr) : internal_ptr(ptr) {}
2825

2926
public:
3027
MutableValuePtr(const MutableValuePtr&) = delete;
@@ -38,11 +35,11 @@ class MutableValuePtr {
3835
return *this;
3936
}
4037

41-
type* get() const { return internal_ptr.get(); }
38+
T* get() const { return internal_ptr.get(); }
4239

4340
explicit operator bool() const { return get() == nullptr; }
44-
type& operator*() const { return *get(); }
45-
type* operator->() const { return get(); }
41+
T& operator*() const { return *get(); }
42+
T* operator->() const { return get(); }
4643

4744
friend class ImmutableValuePtr<T>;
4845

@@ -52,13 +49,10 @@ class MutableValuePtr {
5249

5350
template <class T>
5451
class ImmutableValuePtr {
55-
public:
56-
using type = T;
57-
5852
private:
59-
std::shared_ptr<type> internal_ptr;
53+
std::shared_ptr<T> internal_ptr;
6054

61-
explicit ImmutableValuePtr(type* ptr) : internal_ptr(ptr) {}
55+
explicit ImmutableValuePtr(T* ptr) : internal_ptr(ptr) {}
6256

6357
public:
6458
constexpr ImmutableValuePtr() : internal_ptr(nullptr) {}
@@ -83,11 +77,11 @@ class ImmutableValuePtr {
8377
return *this;
8478
}
8579

86-
type* get() const { return internal_ptr.get(); }
80+
T* get() const { return internal_ptr.get(); }
8781

8882
explicit operator bool() const { return get() == nullptr; }
89-
type& operator*() const { return *get(); }
90-
type* operator->() const { return get(); }
83+
T& operator*() const { return *get(); }
84+
T* operator->() const { return get(); }
9185

9286
MutableValuePtr<T> get_mutable_copy() const {
9387
return MutableValuePtr<T>(new T(*internal_ptr));

0 commit comments

Comments
 (0)