mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 12:53:02 +08:00
[Triplet] Naming convention and missing const
This commit is contained in:
parent
2d758beea9
commit
66eeab0015
@ -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) {}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user