Skip to content

Commit

Permalink
#2063: Update void* to std::byte* in Holder struct
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable authored and cwschilly committed Sep 20, 2024
1 parent 281cf47 commit e50d919
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/vt/objgroup/holder/holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct Holder final : HolderObjBase<ObjT> {
public:
ObjT* get() override { return obj_.get(); }
bool exists() override { return obj_ != nullptr; }
void* getPtr() override { return obj_.get(); }
std::byte* getPtr() override { return reinterpret_cast<std::byte*>(obj_.get()); }

template <typename... Args>
void reset(Args&&... args) {
Expand Down
4 changes: 2 additions & 2 deletions src/vt/objgroup/holder/holder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct HolderBase {

virtual ~HolderBase() = default;
virtual bool exists() = 0;
virtual void* getPtr() = 0;
virtual std::byte* getPtr() = 0;

template <typename Serializer>
void serialize(Serializer& s) {
Expand All @@ -78,7 +78,7 @@ template <typename ObjT>
struct HolderObjBase : HolderBase {
virtual ~HolderObjBase() = default;
virtual ObjT* get() = 0;
virtual void* getPtr() = 0;
virtual std::byte* getPtr() = 0;
};

}}} /* end namespace vt::objgroup::holder */
Expand Down
2 changes: 1 addition & 1 deletion src/vt/objgroup/holder/holder_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct HolderBasic final : HolderObjBase<ObjT> {
public:
ObjT* get() override { return obj_; }
bool exists() override { return obj_ != nullptr; }
void* getPtr() override { return obj_; }
std::byte* getPtr() override { return reinterpret_cast<std::byte*>(obj_); }

template <typename... Args>
void reset(Args&&... args) {
Expand Down
2 changes: 1 addition & 1 deletion src/vt/objgroup/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ ObjT* ObjGroupManager::get(ProxyElmType<ObjT> proxy) {
auto iter = objs_.find(proxy_bits);
vtAssert(iter != objs_.end(), "Obj must exist on this node");
HolderBaseType* holder = iter->second.get();
return static_cast<ObjT*>(holder->getPtr());
return reinterpret_cast<ObjT*>(holder->getPtr());
}

template <typename ObjT, typename... Args>
Expand Down
2 changes: 1 addition & 1 deletion src/vt/objgroup/manager.static.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ decltype(auto) invoke(
return runnable::makeRunnableVoid(false, han, this_node)
.withObjGroup(elm)
.withLBData(lb_data, elm_id)
.runLambda(f, static_cast<ObjT*>(elm), msg.get());
.runLambda(f, reinterpret_cast<ObjT*>(elm), msg.get());
}

template <typename MsgT>
Expand Down
2 changes: 1 addition & 1 deletion src/vt/objgroup/proxy/proxy_objgroup.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ typename Proxy<ObjT>::PendingSendType Proxy<ObjT>::reduce(MsgPtrT inmsg, ReduceS
template <typename ObjT>
ObjT* Proxy<ObjT>::get() const {
auto proxy = Proxy<ObjT>(*this);
return theObjGroup()->get<ObjT>(proxy);
return reinterpret_cast<ObjT*>(theObjGroup()->get<ObjT>(proxy));
}

template <typename ObjT>
Expand Down

0 comments on commit e50d919

Please sign in to comment.