Skip to content

Commit

Permalink
Add operator<< for ParticleType that accepts an rvalue
Browse files Browse the repository at this point in the history
  • Loading branch information
austinschneider committed Mar 4, 2024
1 parent 069eafe commit 98a8517
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/dataclasses/private/ParticleType.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include <iostream>
#include <inttypes.h>

std::ostream & operator<<(std::ostream & os, LI::dataclasses::ParticleType && p) {
LI::dataclasses::ParticleType pp = p;
return operator<<(os, pp);
}

std::ostream & operator<<(std::ostream & os, LI::dataclasses::ParticleType const & p) {
if (LI::dataclasses::ParticleTypeNames.find(p) != LI::dataclasses::ParticleTypeNames.end())
os << LI::dataclasses::ParticleTypeNames.at(p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static const std::map<int32_t, std::string> ParticleTypeIntNames = {
} // namespace LI
} // namespace dataclasses

std::ostream & operator<<(std::ostream & os, LI::dataclasses::ParticleType && p);
std::ostream & operator<<(std::ostream & os, LI::dataclasses::ParticleType const & p);

namespace cereal {
Expand Down

0 comments on commit 98a8517

Please sign in to comment.