fix ambiguous namespace error on MSVC (examples::Rectangle)

fix std::min / std::max problem on MSVC (FYI: http://stackoverflow.com/questions/5004858/stdmin-gives-error)
pull/3109/head
zeliard 10 years ago
parent 7665cf3dde
commit cc9d603200
  1. 10
      cpp/route_guide/route_guide_server.cc

@ -111,14 +111,14 @@ class RouteGuideImpl final : public RouteGuide::Service {
return Status::OK; return Status::OK;
} }
Status ListFeatures(ServerContext* context, const Rectangle* rectangle, Status ListFeatures(ServerContext* context, const examples::Rectangle* rectangle,
ServerWriter<Feature>* writer) override { ServerWriter<Feature>* writer) override {
auto lo = rectangle->lo(); auto lo = rectangle->lo();
auto hi = rectangle->hi(); auto hi = rectangle->hi();
long left = std::min(lo.longitude(), hi.longitude()); long left = (std::min)(lo.longitude(), hi.longitude());
long right = std::max(lo.longitude(), hi.longitude()); long right = (std::max)(lo.longitude(), hi.longitude());
long top = std::max(lo.latitude(), hi.latitude()); long top = (std::max)(lo.latitude(), hi.latitude());
long bottom = std::min(lo.latitude(), hi.latitude()); long bottom = (std::min)(lo.latitude(), hi.latitude());
for (const Feature& f : feature_list_) { for (const Feature& f : feature_list_) {
if (f.location().longitude() >= left && if (f.location().longitude() >= left &&
f.location().longitude() <= right && f.location().longitude() <= right &&

Loading…
Cancel
Save