#include <type_traits>
Go to the source code of this file.
Macros | |
#define | OFFLINE_CAST_CONST_METHOD(_Method_) |
#define OFFLINE_CAST_CONST_METHOD | ( | _Method_ | ) |
To reduce unnecessary code duplication, the otherwise-identical but lengthy const and non-const methods of class can be rewritten so that only the const one has to be implemented while the other is generated by this macro. (Meyers, Effective C++) Example: original code
class Foo { Bar& GetBar(const int i); const Bar& GetBar(const int i) const; };
can be rewritten as
#include <utl/ClassHelpers.h> class Foo { Bar& GetBar(const int i) { return OFFLINE_CAST_CONST_METHOD(GetBar(i)); } const Bar& GetBar(const int i) const; };
and thus reduce the trivial boiler-plate code duplication
Definition at line 51 of file ClassHelpers.h.
Referenced by revt::Station::GetChannel(), revt::Channel::GetChannelADCTimeSeries(), revt::Channel::GetFFTDataContainer(), revt::Station::GetGPSData(), sevt::PMTSimData::GetMultiTrace(), sevt::PMTSimData::GetMultiTraceD(), sevt::Station::GetPMT(), revt::Station::GetRecData(), sevt::Station::GetScintillatorPMT(), revt::Station::GetSimData(), sevt::Station::GetSmallPMT(), sevt::SEvent::GetStation(), revt::REvent::GetStation(), revt::REvent::GetStationByName(), revt::Station::GetStationHeader(), and revt::Station::GetTriggerData().