Fix clang-tidy warning after upgrading to clang-tidy-15

This commit is contained in:
Bartek Kryza
2023-03-02 00:33:28 +01:00
parent 884e021b9a
commit 464d80eca3
25 changed files with 114 additions and 78 deletions

View File

@@ -33,23 +33,38 @@ public:
optional_ref() = default;
optional_ref(T *value) { value_ = value; }
optional_ref(T *value)
: value_{value}
{
}
optional_ref(const T *value) { value_ = value; }
optional_ref(const T *value)
: value_{value}
{
}
optional_ref(T &value) { value_ = &value; }
optional_ref(T &value)
: value_{&value}
{
}
optional_ref(const T &value) { value_ = &value; }
optional_ref(const T &value)
: value_{&value}
{
}
optional_ref(optional_ref &right) { value_ = right.get(); }
optional_ref(optional_ref &right)
: value_{right.get()}
{
}
template <typename V,
typename = std::enable_if<
std::is_base_of_v<optional_type, typename V::optional_type> ||
std::is_same_v<optional_type, typename V::optional_type>>>
optional_ref(const V &t)
: value_{t.get()}
{
value_ = t.get();
}
template <typename V,
@@ -57,16 +72,16 @@ public:
std::is_base_of_v<optional_type, typename V::optional_type> ||
std::is_same_v<optional_type, typename V::optional_type>>>
optional_ref(V &&t)
: value_{t.get()}
{
value_ = t.get();
t.reset();
}
template <typename V,
typename = std::enable_if<std::is_base_of_v<optional_type, V>>>
optional_ref(const std::reference_wrapper<V> &t)
: value_{&t.get()}
{
value_ = &t.get();
}
optional_ref &operator=(const optional_ref &right)