本文整理汇总了C++中osmium::Location::is_undefined方法的典型用法代码示例。如果您正苦于以下问题:C++ Location::is_undefined方法的具体用法?C++ Location::is_undefined怎么用?C++ Location::is_undefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osmium::Location
的用法示例。
在下文中一共展示了Location::is_undefined方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: REQUIRE
#include "catch.hpp"
#include <osmium/osm/location.hpp>
#include <limits>
#include <sstream>
#include <type_traits>
// fails on MSVC and doesn't really matter
// static_assert(std::is_literal_type<osmium::Location>::value, "osmium::Location not literal type");
TEST_CASE("Location instantiation with default parameters") {
const osmium::Location loc;
REQUIRE_FALSE(loc);
REQUIRE_FALSE(loc.is_defined());
REQUIRE(loc.is_undefined());
REQUIRE_THROWS_AS(loc.lon(), const osmium::invalid_location&);
REQUIRE_THROWS_AS(loc.lat(), const osmium::invalid_location&);
}
TEST_CASE("Location instantiation with double parameters") {
const osmium::Location loc1{1.2, 4.5};
REQUIRE(bool(loc1));
REQUIRE(loc1.is_defined());
REQUIRE_FALSE(loc1.is_undefined());
REQUIRE(12000000 == loc1.x());
REQUIRE(45000000 == loc1.y());
REQUIRE(1.2 == Approx(loc1.lon()));
REQUIRE(4.5 == Approx(loc1.lat()));
const osmium::Location loc2{loc1};