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.
#if OGLPLUS_LOW_PROFILE
template <typename T>
struct SizeImpl
{
typedef T Type;
};
#else // !OGLPLUS_LOW_PROFILE
template <typename T>
struct SizeImpl
{
public:
typedef SizeImpl Type;
SizeImpl(void)
noexcept;
template <typename X, typename = typename is_integral<X>::type>
SizeImpl(X v);
explicit
operator bool (void) const
noexcept;
bool operator ! (void) const
noexcept;
operator T (void) const
noexcept;
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 |
|
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 typename SizeImpl<GLsizei>::Type SizeType; typedef typename SizeImpl<GLsizeiptr>::Type BigSizeType; template <typename X, typename = typename is_integral<X>::type> SizeImpl MakeSizeImpl(X v, std::nothrow_t) noexcept;