Use concepts in geom::point and vector constructors
This commit is contained in:
parent
b467af74c9
commit
67c7ce0878
3 changed files with 4 additions and 15 deletions
|
|
@ -34,7 +34,6 @@ namespace psemek::geom::detail
|
||||||
template <typename T, typename ... Args>
|
template <typename T, typename ... Args>
|
||||||
struct all_convertible_to;
|
struct all_convertible_to;
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct all_convertible_to<T>
|
struct all_convertible_to<T>
|
||||||
: std::true_type
|
: std::true_type
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,9 @@ namespace psemek::geom
|
||||||
typename detail::array<T, N>::type coords;
|
typename detail::array<T, N>::type coords;
|
||||||
|
|
||||||
point() = default;
|
point() = default;
|
||||||
point(point const &) = default;
|
|
||||||
point(point &) = default;
|
|
||||||
point(point &&) = default;
|
|
||||||
point & operator = (point const &) = default;
|
|
||||||
point & operator = (point &) = default;
|
|
||||||
point & operator = (point &&) = default;
|
|
||||||
|
|
||||||
template <typename ... Args, typename = std::enable_if_t<(sizeof...(Args) == N) && detail::all_convertible_to<T, Args...>::value>>
|
template <typename ... Args>
|
||||||
|
requires((sizeof...(Args) == N) && detail::all_convertible_to<T, Args...>::value)
|
||||||
point(Args && ... args)
|
point(Args && ... args)
|
||||||
: coords{ static_cast<T>(std::forward<Args>(args))... }
|
: coords{ static_cast<T>(std::forward<Args>(args))... }
|
||||||
{}
|
{}
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,9 @@ namespace psemek::geom
|
||||||
typename detail::array<T, N>::type coords;
|
typename detail::array<T, N>::type coords;
|
||||||
|
|
||||||
vector() = default;
|
vector() = default;
|
||||||
vector(vector const &) = default;
|
|
||||||
vector(vector &) = default;
|
|
||||||
vector(vector &&) = default;
|
|
||||||
vector & operator = (vector const &) = default;
|
|
||||||
vector & operator = (vector &) = default;
|
|
||||||
vector & operator = (vector &&) = default;
|
|
||||||
|
|
||||||
template <typename ... Args, typename = std::enable_if_t<(sizeof...(Args) == N) && detail::all_convertible_to<T, Args...>::value>>
|
template <typename ... Args>
|
||||||
|
requires((sizeof...(Args) == N) && detail::all_convertible_to<T, Args...>::value)
|
||||||
vector(Args && ... args)
|
vector(Args && ... args)
|
||||||
: coords{ static_cast<T>(std::forward<Args>(args))... }
|
: coords{ static_cast<T>(std::forward<Args>(args))... }
|
||||||
{}
|
{}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue