OGLplus defines a wrapper for size types represented in OpenGL, OpenAL,
etc. by integer like GLsizei
or GLsizeiptr
.
Instances of this type are constructible from integral types and the constructors can throw if the initial value is negative or out of range.
template <typename T> struct SizeImpl { public: SizeImpl(void)noexcept; template <typename X, typename = typename is_integral<X>::type> SizeImpl(X v);
template <typename X, typename = typename is_integral<X>::type> SizeImpl(X v, std::nothrow_t) noexcept;
T get(void) const noexcept; explicit operator bool (void) const noexcept;
bool operator ! (void) const noexcept;
operator T (void) const;
template <typename X> explicit operator X (void) const;
friend bool operator == (SizeImpl s1, SizeImpl s2); friend bool operator != (SizeImpl s1, SizeImpl s2); friend bool operator < (SizeImpl s1, SizeImpl s2); friend bool operator <= (SizeImpl s1, SizeImpl s2); friend bool operator > (SizeImpl s1, SizeImpl s2); friend bool operator >= (SizeImpl s1, SizeImpl s2); friend bool operator + (SizeImpl s1, SizeImpl s2); friend bool operator - (SizeImpl s1, SizeImpl s2); friend bool operator * (SizeImpl s1, SizeImpl s2); friend bool operator / (SizeImpl s1, SizeImpl s2); friend bool operator % (SizeImpl s1, SizeImpl s2); };
Constructs a zero size instance. |
|
Conversion from other signed or unsigned integral types. Throws if
the passed value is negative or out of range of |
|
Conversion from other signed or unsigned integral types. Does not throw. |
|
Indicates if the stored value is valid i.e. nonnegativa and was in
range of |
|
Indicates if the stored value is invalid i.e. negative or was out of
range of |
|
Implicit conversion to |
|
Explicit conversion to other (integral) types. May throw if the stored
value is negative and |
typedef SizeImpl<GLsizei> SizeType; typedef SizeImpl<GLsizeiptr> BigSizeType;