Browse Source

Old-Style casts removed.

main
offa 7 years ago
parent
commit
4fd08c83d9
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +3
    -3
      include/unique_resource.h

+ 1
- 1
CMakeLists.txt View File

-pedantic -pedantic
-Werror -Werror
-Wshadow -Wshadow
#-Wold-style-cast
-Wold-style-cast
) )





+ 3
- 3
include/unique_resource.h View File

} }




// TODO: Fix old-style casts
template<class T> template<class T>
struct Wrapper struct Wrapper
{ {
template<class TT, class G, std::enable_if_t<std::is_constructible<T, TT>::value, int> = 0> template<class TT, class G, std::enable_if_t<std::is_constructible<T, TT>::value, int> = 0>
explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(Wrapper{(T&&) value})) : Wrapper((T&&) value)
explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(Wrapper{value})) : Wrapper(value)
{ {
g.release(); g.release();
} }
struct Wrapper<T&> struct Wrapper<T&>
{ {
template<class TT, class G, std::enable_if_t<std::is_convertible<TT, T&>::value, int> = 0> template<class TT, class G, std::enable_if_t<std::is_convertible<TT, T&>::value, int> = 0>
explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(static_cast<T&>((TT&&) value))) : m_value((T&) value)
explicit Wrapper(TT&& value, G&& g) noexcept(noexcept(static_cast<T&>(value))) : m_value(static_cast<T&>(value))
{ {
g.release(); g.release();
} }

Loading…
Cancel
Save