1 /**************************************************************************
3 * Copyright 2013-2014 RAD Game Tools and Valve Software
4 * Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 **************************************************************************/
27 // File: vogl_helpers.h
30 #include "vogl_core.h"
32 #define VOGL_NO_COPY_OR_ASSIGNMENT_OP(c) \
34 c &operator=(const c &);
35 #define VOGL_NO_HEAP_ALLOC() \
38 static void *operator new(size_t); \
39 static void *operator new[](size_t);
48 friend bool operator!=(const T &x, const T &y)
52 friend bool operator>(const T &x, const T &y)
56 friend bool operator<=(const T &x, const T &y)
60 friend bool operator>=(const T &x, const T &y)
67 inline T *construct(T *p)
69 return new (static_cast<void *>(p)) T;
72 template <typename T, typename U>
73 inline T *construct(T *p, const U &init)
75 return new (static_cast<void *>(p)) T(init);
79 inline void construct_array(T *p, uint n)
83 new (static_cast<void *>(p)) T;
86 template <typename T, typename U>
87 inline void construct_array(T *p, uint n, const U &init)
91 new (static_cast<void *>(p)) T(init);
95 inline void destruct(T *p)
100 template <typename T>
101 inline void destruct_array(T *p, uint n)
108 } // namespace helpers