Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tree/ntuple/inc/ROOT/REntry.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public:
template <typename T>
void BindRawPtr(std::string_view fieldName, T *rawPtr)
{
BindRawPtr<void>(GetToken(fieldName), rawPtr);
BindRawPtr<T>(GetToken(fieldName), rawPtr);
}

/// Get the (typed) pointer to the value for the field referenced by `token`.
Expand Down
6 changes: 6 additions & 0 deletions tree/ntuple/test/ntuple_basics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,12 @@ TEST(REntry, Basics)
EXPECT_EQ("float", e->GetTypeName("pt"));
EXPECT_EQ("float", e->GetTypeName(model->GetToken("pt")));

float rawPt;
double wrongType;
e->BindRawPtr("pt", &rawPt);
EXPECT_EQ(&rawPt, e->GetPtr<float>("pt").get());
EXPECT_THROW(e->BindRawPtr("pt", &wrongType), ROOT::RException);

auto ptrPt = std::make_shared<float>();
e->BindValue("pt", ptrPt);
EXPECT_EQ(ptrPt.get(), e->GetPtr<float>("pt").get());
Expand Down
Loading