|
(Note that these are not member functions.)
|
| template<typename T > |
| size_c< T > | make_size_c (const std::pair< T, T > &pa) DXLE_NOEXCEPT_IF(std |
| | conversion from std::pair More...
|
| |
| template<typename T > |
| size_c< T > | make_size_c (std::pair< T, T > &&pa) DXLE_NOEXCEPT_OR_NOTHROW |
| | conversion from std::pair More...
|
| |
| template<typename T > |
| std::ostream & | operator<< (std::ostream &os, const size_c< T > &s) |
| | ostream operator More...
|
| |
| template<typename T > |
| std::wostream & | operator<< (std::wostream &os, const size_c< T > &s) |
| | ostream operator More...
|
| |
| template<typename T > |
| std::istream & | operator>> (std::istream &is, size_c< T > &s) |
| | istream operator More...
|
| |
| template<typename T > |
| std::wistream & | operator>> (std::wistream &is, size_c< T > &s) |
| | istream operator More...
|
| |
| template<typename T > |
| DXLE_CONSTEXPR size_c< T > | operator- (const size_c< T > &r) DXLE_NOEXCEPT_IF_EXPR(-r.width) |
| | Overload of unary operator -. More...
|
| |
| template<typename T > |
| DXLE_CONSTEXPR size_c< T > | operator+ (const size_c< T > &r) DXLE_NOEXCEPT_IF(std |
| | Overload of unary operator +. More...
|
| |
| template<typename T > |
| DXLE_CONSTEXPR size_c< T > && | operator+ (size_c< T > &&r) DXLE_NOEXCEPT_OR_NOTHROW |
| | Overload of unary operator +. More...
|
| |
| template<typename T1 , typename T2 , enable_if_t< is_representable< T2, T1 >::value, nullptr_t > = nullptr> |
| size_c< T1 > & | operator+= (size_c< T1 > &l, const size_c< T2 > &r) DXLE_NOEXCEPT_IF_EXPR(l.width+ |
| | Overload of binary operator +=. More...
|
| |
| template<typename T1 , typename T2 > |
| DXLE_CONSTEXPR auto | operator- (const size_c< T1 > &l, const size_c< T2 > &r) DXLE_NOEXCEPT_IF_EXPR(l.width - r.width) -> size_c< decltype(std::declval< std::remove_cv_t< T1 >>() - std::declval< std::remove_cv_t< T2 >>())> |
| | Overload of binary operator -. More...
|
| |
| template<typename T1 , typename T2 > |
| DXLE_CONSTEXPR auto | operator* (const size_c< T1 > &l, T2 r) DXLE_NOEXCEPT_IF_EXPR(l.width *r) -> size_c< decltype(std::declval< std::remove_cv_t< T1 >>() *std::declval< std::remove_cv_t< T2 >>())> |
| | Overload of binary operator *. More...
|
| |
| template<typename T1 , typename T2 > |
| DXLE_CONSTEXPR auto | operator* (T1 l, const size_c< T2 > &r) DXLE_NOEXCEPT_IF_EXPR(l *r.width) -> size_c< decltype(std::declval< std::remove_cv_t< T1 >>() *std::declval< std::remove_cv_t< T2 >>())> |
| | Overload of binary operator *. More...
|
| |
| template<typename T1 , typename T2 , enable_if_t< is_representable< T2, T1 >::value, nullptr_t > = nullptr> |
| size_c< T1 > & | operator*= (size_c< T1 > &l, T2 r) DXLE_NOEXCEPT_IF_EXPR(l.width * |
| | Overload of binary operator *=. More...
|
| |
| template<typename T1 , typename T2 , enable_if_t< is_representable< T2, T1 >::value, nullptr_t > = nullptr> |
| size_c< T1 > & | operator/= (size_c< T1 > &l, T2 r) DXLE_NOEXCEPT_IF_EXPR(l.width/ |
| | Overload of binary operator /=. More...
|
| |
| template<typename T1 , typename T2 > |
| DXLE_CONSTEXPR auto | operator+ (const size_c< T1 > &l, const point_c< T2 > &r) DXLE_NOEXCEPT_IF_EXPR(l.width+r.x) -> size_c< decltype(std::declval< std::remove_cv_t< T1 >>()+std::declval< std::remove_cv_t< T2 >>())> |
| | Overload of binary operator +. More...
|
| |
| template<typename T1 , typename T2 > |
| DXLE_CONSTEXPR auto | operator- (const size_c< T1 > &l, const point_c< T2 > &r) DXLE_NOEXCEPT_IF_EXPR(l.width - r.x) -> size_c< decltype(std::declval< std::remove_cv_t< T1 >>() - std::declval< std::remove_cv_t< T2 >>())> |
| | Overload of binary operator -. More...
|
| |
template<typename T, enable_if_t< std::is_nothrow_move_constructible< T >::value &&std::is_nothrow_move_assignable< T >::value, nullptr_t > = nullptr>
class dxle::size_c< T, >
Template class for 2D sizes specified by its coordinates width and height.
An instance of the claess is interchangeable with std::pair. There is also a cast operator to convert size coordinates to the specified type (using static_cast). Commonly, the conversion uses this operation for each of the coordinates. Besides the class members listed in the declaration above, the following operations on sizes are implemented:
pt1 = pt2 + pt3;
pt1 = pt2 - pt3;
pt1 = pt2 * a;
pt1 = a * pt2;
pt1 = pt2 / a;
pt1 += pt2;
pt1 -= pt2;
pt1 *= a;
pt1 /= a;
pt1 == pt2;
pt1 != pt2;
For your convenience, the following type aliases are defined:
typedef size_c<int> sizei;
typedef size_c<unsigned int>
sizeui;
typedef size_c<double>
sized;
typedef size_c<float>
sizef;
typedef size_c<std::size_t>
size;
Example:
dxle::sizei pt = (a + b)*10.f;
std::cout << pt << std::endl;
- Template Parameters
-
Definition at line 36 of file point2d.hpp.