OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / stack_array.h
diff --git a/SlimDXc_Jun2010(VC++2008)/source/stack_array.h b/SlimDXc_Jun2010(VC++2008)/source/stack_array.h
deleted file mode 100644 (file)
index 84c9b2f..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-#pragma once\r
-\r
-#define stackalloc(type, length) stack_array<type>::from_stack_ptr(reinterpret_cast<type*>(_malloca(sizeof(type) * length)), length)\r
-\r
-template<typename T>\r
-struct stack_array_ref\r
-{\r
-       explicit stack_array_ref(T *right, size_t length, bool on_stack)\r
-               :       ptr(right),\r
-                       len(length),\r
-                       on_stack(on_stack)\r
-       {\r
-       }\r
-\r
-       T *ptr;\r
-       size_t len;\r
-       bool on_stack;\r
-};\r
-\r
-template<typename T>\r
-class stack_array\r
-{\r
-private:\r
-       T* ptr;\r
-       size_t len;\r
-       bool on_stack;\r
-\r
-       explicit stack_array(T* memory, size_t length) throw()\r
-               :       len(length),\r
-                       ptr(memory),\r
-                       on_stack(true)\r
-       {\r
-       }\r
-\r
-public:\r
-       explicit stack_array(size_t length = 0) throw()\r
-               :       len(length),\r
-                       ptr(new T[length]),\r
-                       on_stack(false)\r
-       {\r
-       }\r
-\r
-       stack_array(stack_array<T>& right) throw()\r
-               :       ptr(right.ptr),\r
-                       len(right.len),\r
-                       on_stack(right.on_stack)\r
-       {\r
-               right.ptr = NULL;\r
-               right.len = 0;\r
-               right.on_stack = false;\r
-       }\r
-\r
-       stack_array(stack_array_ref<T> right) throw()\r
-       {\r
-               ptr = right.ptr;\r
-               len = right.len;\r
-               on_stack = right.on_stack;\r
-\r
-               right.ptr = NULL;\r
-       }\r
-\r
-       ~stack_array()\r
-       {\r
-               if (on_stack)\r
-                       _freea(ptr);\r
-               else\r
-                       delete[] ptr;\r
-       }\r
-\r
-       static stack_array<T> from_stack_ptr(T* memory, size_t length)\r
-       {\r
-               return stack_array<T>(memory, length);\r
-       }\r
-\r
-       operator stack_array_ref<T>() throw()\r
-       {\r
-               stack_array_ref<T> ans(ptr, len, on_stack);\r
-               ptr = NULL;\r
-               len = 0;\r
-               on_stack = false;\r
-\r
-               return ans;\r
-       }\r
-\r
-       stack_array<T>& operator = (stack_array<T>& right) throw()\r
-       {\r
-               if (right.ptr != ptr)\r
-               {\r
-                       if (on_stack)\r
-                               _freea(ptr);\r
-                       else\r
-                               delete[] ptr;\r
-               }\r
-\r
-               ptr = right.ptr;\r
-               len = right.len;\r
-               on_stack = right.on_stack;\r
-\r
-               right.ptr = NULL;\r
-               right.len = 0;\r
-               right.on_stack = false;\r
-\r
-               return *this;\r
-       }\r
-\r
-       stack_array<T>& operator = (stack_array_ref<T> right) throw()\r
-       {\r
-               if (right.ptr != ptr)\r
-               {\r
-                       if (on_stack)\r
-                               _freea(ptr);\r
-                       else\r
-                               delete[] ptr;\r
-               }\r
-\r
-               ptr = right.ptr;\r
-               len = right.len;\r
-               on_stack = right.on_stack;\r
-\r
-               return *this;\r
-       }\r
-\r
-       const T* get() const\r
-       {\r
-               return ptr;\r
-       }\r
-\r
-       T* get() throw()\r
-       {\r
-               return ptr;\r
-       }\r
-\r
-       size_t size() const throw()\r
-       {\r
-               return len;\r
-       }\r
-\r
-       T& operator [] (size_t index)\r
-       {\r
-               return ptr[index];\r
-       }\r
-\r
-       const T& operator [] (size_t index) const\r
-       {\r
-               return ptr[index];\r
-       }\r
-};
\ No newline at end of file