[Triplet] Naming convention and missing const

This commit is contained in:
Alexander Karatarakis 2017-09-01 17:08:21 -07:00
parent 2d758beea9
commit 66eeab0015
2 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ namespace vcpkg
struct Triplet
{
public:
constexpr Triplet() : m_instance(&default_instance) {}
constexpr Triplet() : m_instance(&DEFAULT_INSTANCE) {}
static Triplet from_canonical_name(const std::string& triplet_as_string);
@ -26,7 +26,7 @@ namespace vcpkg
bool operator==(const Triplet& other) const;
private:
static const TripletInstance default_instance;
static const TripletInstance DEFAULT_INSTANCE;
constexpr Triplet(const TripletInstance* ptr) : m_instance(ptr) {}

View File

@ -15,7 +15,7 @@ namespace vcpkg
bool operator==(const TripletInstance& o) const { return o.value == value; }
};
const TripletInstance Triplet::default_instance({});
const TripletInstance Triplet::DEFAULT_INSTANCE({});
}
template<>
@ -41,10 +41,10 @@ namespace vcpkg
Triplet Triplet::from_canonical_name(const std::string& triplet_as_string)
{
std::string s(Strings::ascii_to_lowercase(triplet_as_string));
auto it = std::find(s.cbegin(), s.cend(), '-');
const auto it = std::find(s.cbegin(), s.cend(), '-');
Checks::check_exit(VCPKG_LINE_INFO, it != s.cend(), "Invalid triplet: %s", triplet_as_string);
auto p = g_triplet_instances.emplace(std::move(s));
const auto p = g_triplet_instances.emplace(std::move(s));
return &*p.first;
}