Skip to content

Commit

Permalink
Merge pull request #51 from mapbox/g++-4.9
Browse files Browse the repository at this point in the history
Build for g++-4.9
  • Loading branch information
brunoabinader authored Jul 6, 2017
2 parents b0d64e6 + 2c71de6 commit b0e41cc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ sudo: false

matrix:
include:
- os: linux
env: CXX=g++-4.9
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'g++-4.9' ]
- os: linux
env: CXX=g++-5
addons:
Expand Down
9 changes: 9 additions & 0 deletions include/mapbox/geometry/feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ struct feature
geometry_type geometry;
property_map properties {};
std::experimental::optional<identifier> id {};

// GCC 4.9 does not support C++14 aggregates with non-static data member
// initializers.
feature(geometry_type geometry_,
property_map properties_ = property_map {},
std::experimental::optional<identifier> id_ = std::experimental::optional<identifier> {})
: geometry(std::move(geometry_)),
properties(std::move(properties_)),
id(std::move(id_)) {}
};

template <class T>
Expand Down
32 changes: 16 additions & 16 deletions include/mapbox/geometry/point_arithmetic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,111 +4,111 @@ namespace mapbox {
namespace geometry {

template <typename T>
constexpr point<T> operator+(point<T> const& lhs, point<T> const& rhs)
point<T> operator+(point<T> const& lhs, point<T> const& rhs)
{
return point<T>(lhs.x + rhs.x, lhs.y + rhs.y);
}

template <typename T>
constexpr point<T> operator+(point<T> const& lhs, T const& rhs)
point<T> operator+(point<T> const& lhs, T const& rhs)
{
return point<T>(lhs.x + rhs, lhs.y + rhs);
}

template <typename T>
constexpr point<T> operator-(point<T> const& lhs, point<T> const& rhs)
point<T> operator-(point<T> const& lhs, point<T> const& rhs)
{
return point<T>(lhs.x - rhs.x, lhs.y - rhs.y);
}

template <typename T>
constexpr point<T> operator-(point<T> const& lhs, T const& rhs)
point<T> operator-(point<T> const& lhs, T const& rhs)
{
return point<T>(lhs.x - rhs, lhs.y - rhs);
}

template <typename T>
constexpr point<T> operator*(point<T> const& lhs, point<T> const& rhs)
point<T> operator*(point<T> const& lhs, point<T> const& rhs)
{
return point<T>(lhs.x * rhs.x, lhs.y * rhs.y);
}

template <typename T>
constexpr point<T> operator*(point<T> const& lhs, T const& rhs)
point<T> operator*(point<T> const& lhs, T const& rhs)
{
return point<T>(lhs.x * rhs, lhs.y * rhs);
}

template <typename T>
constexpr point<T> operator/(point<T> const& lhs, point<T> const& rhs)
point<T> operator/(point<T> const& lhs, point<T> const& rhs)
{
return point<T>(lhs.x / rhs.x, lhs.y / rhs.y);
}

template <typename T>
constexpr point<T> operator/(point<T> const& lhs, T const& rhs)
point<T> operator/(point<T> const& lhs, T const& rhs)
{
return point<T>(lhs.x / rhs, lhs.y / rhs);
}

template <typename T>
constexpr point<T>& operator+=(point<T>& lhs, point<T> const& rhs)
point<T>& operator+=(point<T>& lhs, point<T> const& rhs)
{
lhs.x += rhs.x;
lhs.y += rhs.y;
return lhs;
}

template <typename T>
constexpr point<T>& operator+=(point<T>& lhs, T const& rhs)
point<T>& operator+=(point<T>& lhs, T const& rhs)
{
lhs.x += rhs;
lhs.y += rhs;
return lhs;
}

template <typename T>
constexpr point<T>& operator-=(point<T>& lhs, point<T> const& rhs)
point<T>& operator-=(point<T>& lhs, point<T> const& rhs)
{
lhs.x -= rhs.x;
lhs.y -= rhs.y;
return lhs;
}

template <typename T>
constexpr point<T>& operator-=(point<T>& lhs, T const& rhs)
point<T>& operator-=(point<T>& lhs, T const& rhs)
{
lhs.x -= rhs;
lhs.y -= rhs;
return lhs;
}

template <typename T>
constexpr point<T>& operator*=(point<T>& lhs, point<T> const& rhs)
point<T>& operator*=(point<T>& lhs, point<T> const& rhs)
{
lhs.x *= rhs.x;
lhs.y *= rhs.y;
return lhs;
}

template <typename T>
constexpr point<T>& operator*=(point<T>& lhs, T const& rhs)
point<T>& operator*=(point<T>& lhs, T const& rhs)
{
lhs.x *= rhs;
lhs.y *= rhs;
return lhs;
}

template <typename T>
constexpr point<T>& operator/=(point<T>& lhs, point<T> const& rhs)
point<T>& operator/=(point<T>& lhs, point<T> const& rhs)
{
lhs.x /= rhs.x;
lhs.y /= rhs.y;
return lhs;
}

template <typename T>
constexpr point<T>& operator/=(point<T>& lhs, T const& rhs)
point<T>& operator/=(point<T>& lhs, T const& rhs)
{
lhs.x /= rhs;
lhs.y /= rhs;
Expand Down

0 comments on commit b0e41cc

Please sign in to comment.