Skip to content

Commit 76e88cb

Browse files
authored
Deprecate the usage of -> instead of . for objects that are not pointers (#811)
* Deprecate operator-> for objects that are not pointers * Fix the deprecation warning in podio --------- Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
1 parent c630732 commit 76e88cb

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

python/templates/Collection.h.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public:
7474
void print(std::ostream& os=std::cout, bool flush=true) const final;
7575

7676
/// operator to allow pointer like calling of members a la LCIO
77+
[[deprecated("Use of operator->() is deprecated. Use . instead.")]]
7778
{{ class.bare_type }}Collection* operator->() { return static_cast<{{ class.bare_type }}Collection*>(this); }
7879

7980
/// Append a new object to the collection, and return this object.

tests/unittests/frame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,10 @@ TEST_CASE("Frame destructor ASanFail") {
398398
auto& hitClusters = hitClusterMap[name];
399399

400400
for (int i = 0; i < 3; ++i) {
401-
auto cluster = hitClusters.first->create();
401+
auto cluster = hitClusters.first.create();
402402

403403
for (int j = 0; j < 5; ++j) {
404-
auto hit = hitClusters.second->create();
404+
auto hit = hitClusters.second.create();
405405
cluster.addHits(hit);
406406
}
407407
}

0 commit comments

Comments
 (0)