Skip to content

Commit 42d3604

Browse files
committed
8359923: Const accessors for the Deferred class
Reviewed-by: jsjolen
1 parent cf78925 commit 42d3604

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/hotspot/share/utilities/deferred.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,27 @@ class Deferred {
5656
return &_t;
5757
}
5858

59+
const T* get() const {
60+
assert(_initialized, "must be initialized before access");
61+
return &_t;
62+
}
63+
5964
T& operator*() {
6065
return *get();
6166
}
6267

68+
const T& operator*() const {
69+
return *get();
70+
}
71+
6372
T* operator->() {
6473
return get();
6574
}
6675

76+
const T* operator->() const {
77+
return get();
78+
}
79+
6780
template<typename... Ts>
6881
void initialize(Ts&... args) {
6982
assert(!_initialized, "Double initialization forbidden");

0 commit comments

Comments
 (0)