Skip to content

Commit

Permalink
constexpr is still unsupported for classes on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
alex85k committed Aug 20, 2014
1 parent aba2668 commit e76438d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
6 changes: 5 additions & 1 deletion include/osmium/index/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ namespace osmium {
* the full range, so the max value is a good "empty" value.
*/
template <>
inline constexpr size_t empty_value<size_t>() {
inline
#ifndef _MSC_VER
constexpr
#endif
size_t empty_value<size_t>() {
return std::numeric_limits<size_t>::max();
}

Expand Down
16 changes: 13 additions & 3 deletions include/osmium/osm/box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ namespace osmium {
/**
* Bottom-left location.
*/
constexpr Location bottom_left() const noexcept {
#ifndef _MSC_VER
constexpr
#endif
Location bottom_left() const noexcept {
return m_bottom_left;
}

Expand All @@ -143,7 +146,10 @@ namespace osmium {
/**
* Top-right location.
*/
constexpr Location top_right() const noexcept {
#ifndef _MSC_VER
constexpr
#endif
Location top_right() const noexcept{
return m_top_right;
}

Expand Down Expand Up @@ -177,7 +183,11 @@ namespace osmium {
/**
* Boxes are equal if both locations are equal.
*/
inline constexpr bool operator==(const Box& lhs, const Box& rhs) noexcept {
inline
#ifndef _MSC_VER
constexpr
#endif
bool operator==(const Box& lhs, const Box& rhs) noexcept {
return lhs.bottom_left() == rhs.bottom_left() && lhs.top_right() == rhs.top_right();
}

Expand Down
12 changes: 10 additions & 2 deletions include/osmium/osm/timestamp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,19 @@ namespace osmium {

}; // class Timestamp

inline constexpr Timestamp start_of_time() {
inline
#ifndef _MSC_VER
constexpr
#endif
Timestamp start_of_time() {
return Timestamp(1);
}

inline constexpr Timestamp end_of_time() {
inline
#ifndef _MSC_VER
constexpr
#endif
Timestamp end_of_time() {
return Timestamp(std::numeric_limits<time_t>::max());
}

Expand Down

0 comments on commit e76438d

Please sign in to comment.