Skip to content

Commit

Permalink
config: Inline trivial Wrap functions
Browse files Browse the repository at this point in the history
All Wrap functions are trivial and can be optimized away, as they become no-ops when inlined.
  • Loading branch information
MattiasTF committed Oct 16, 2024
1 parent 7d67854 commit d188f69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 58 deletions.
20 changes: 10 additions & 10 deletions software/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,17 +555,17 @@ struct Config {
class Wrap
{
public:
Wrap(Config *_conf);
inline Wrap(Config *_conf) {conf = _conf;}

Config *operator->();
inline Config *operator->() {return conf;}

explicit operator Config*();
inline explicit operator Config*() {return conf;}

// Allowing to call begin and end directly on
// the wrapper makes it easier to use
// range-based for loops.
std::vector<Config>::iterator begin();
std::vector<Config>::iterator end();
inline std::vector<Config>::iterator begin() {return conf->begin();}
inline std::vector<Config>::iterator end() {return conf->end(); }

private:
Config *conf;
Expand All @@ -575,14 +575,14 @@ struct Config {
class ConstWrap
{
public:
ConstWrap(const Config *_conf);
inline ConstWrap(const Config *_conf) {conf = _conf;}

const Config *operator->() const;
inline const Config *operator->() const {return conf;}

explicit operator const Config*() const;
inline explicit operator const Config*() const {return conf;}

std::vector<Config>::const_iterator begin() const;
std::vector<Config>::const_iterator end() const;
inline std::vector<Config>::const_iterator begin() const {return conf->begin();}
inline std::vector<Config>::const_iterator end() const {return conf->end(); }

private:
const Config *conf;
Expand Down
48 changes: 0 additions & 48 deletions software/src/config/wrap.cpp

This file was deleted.

0 comments on commit d188f69

Please sign in to comment.