Skip to content

Commit

Permalink
Make non-static constexpr member functions const.
Browse files Browse the repository at this point in the history
This fixes warnings from the Xcode 7.3 compiler on Darwin about
compatibility with C++14.
  • Loading branch information
mjansche committed Apr 19, 2016
1 parent 36f3903 commit b49c158
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions festus/value-weight-singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ValueWeightSingleton {
return ValueWeightSingleton(Semiring().From(std::forward<Args>(args)...));
}

constexpr ValueType Value() { return value_; }
constexpr ValueType Value() const { return value_; }

static constexpr const S &Semiring() { return Singleton::Instance(); }

Expand Down Expand Up @@ -133,11 +133,11 @@ class ValueWeightSingleton {
return w;
}

constexpr ValueWeightSingleton Reverse() {
constexpr ValueWeightSingleton Reverse() const {
return ValueWeightSingleton(Semiring().Reverse(value_));
}

constexpr ValueWeightSingleton Quantize(float delta = fst::kDelta) {
constexpr ValueWeightSingleton Quantize(float delta = fst::kDelta) const {
return ValueWeightSingleton(Semiring().Quantize(value_, delta));
}

Expand All @@ -162,7 +162,7 @@ class ValueWeightSingleton {
return Semiring().ApproxEqualTo(lhs.value_, rhs.value_, delta);
}

constexpr std::size_t Hash() { return std::hash<ValueType>()(value_); }
constexpr std::size_t Hash() const { return std::hash<ValueType>()(value_); }

friend std::ostream &operator<<(
std::ostream &strm,
Expand Down
8 changes: 4 additions & 4 deletions festus/value-weight-static.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ValueWeightStatic {
return ValueWeightStatic(SemiringType::From(std::forward<Args>(args)...));
}

constexpr ValueType Value() { return value_; }
constexpr ValueType Value() const { return value_; }

static constexpr ValueWeightStatic NoWeight() {
return ValueWeightStatic(SemiringType::NoWeight());
Expand Down Expand Up @@ -110,11 +110,11 @@ class ValueWeightStatic {
return w;
}

constexpr ValueWeightStatic Reverse() {
constexpr ValueWeightStatic Reverse() const {
return ValueWeightStatic(SemiringType::Reverse(value_));
}

constexpr ValueWeightStatic Quantize(float delta = fst::kDelta) {
constexpr ValueWeightStatic Quantize(float delta = fst::kDelta) const {
return ValueWeightStatic(SemiringType::Quantize(value_, delta));
}

Expand All @@ -139,7 +139,7 @@ class ValueWeightStatic {
return SemiringType::ApproxEqualTo(lhs.value_, rhs.value_, delta);
}

constexpr std::size_t Hash() { return std::hash<ValueType>()(value_); }
constexpr std::size_t Hash() const { return std::hash<ValueType>()(value_); }

friend std::ostream &operator<<(
std::ostream &strm,
Expand Down

0 comments on commit b49c158

Please sign in to comment.