![]() |
![]() |
|
00001 /* ///////////////////////////////////////////////////////////////////////////// 00002 * File: src/shwild_vector.hpp 00003 * 00004 * Purpose: vector class for shwild implementation 00005 * 00006 * Created: 17th June 2005 00007 * Updated: 6th April 2008 00008 * 00009 * Home: http://shwild.org/ 00010 * 00011 * Copyright (c) 2005-2008, Matthew Wilson and Sean Kelly 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are met: 00016 * 00017 * - Redistributions of source code must retain the above copyright notice, this 00018 * list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * - Neither the names of Matthew Wilson and Sean Kelly nor the names of 00023 * any contributors may be used to endorse or promote products derived from 00024 * this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * ////////////////////////////////////////////////////////////////////////// */ 00039 00040 00041 #ifndef SHWILD_INCL_HPP_SHWILD_VECTORVECTOR 00042 #define SHWILD_INCL_HPP_SHWILD_VECTORVECTOR 00043 00044 /* ///////////////////////////////////////////////////////////////////////////// 00045 * Version information 00046 */ 00047 00048 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION 00049 # define SHWILD_VER_SHWILD_VECTOR_MAJOR 1 00050 # define SHWILD_VER_SHWILD_VECTOR_MINOR 0 00051 # define SHWILD_VER_SHWILD_VECTOR_REVISION 5 00052 # define SHWILD_VER_SHWILD_VECTOR_EDIT 6 00053 #endif /* !SHWILD_DOCUMENTATION_SKIP_SECTION */ 00054 00055 /* ///////////////////////////////////////////////////////////////////////////// 00056 * Includes 00057 */ 00058 00059 #include <shwild/shwild.h> 00060 00061 #include <stlsoft/stlsoft.h> /* If the compiler cannot find this, you are not using STLSoft 1.9 or later, as required. */ 00062 #if !defined(_STLSOFT_VER) || \ 00063 _STLSOFT_VER < 0x01091eff 00064 # error Requires STLSoft 1.9.30, or later. (www.stlsoft.org/downloads.html) 00065 #endif /* STLSoft version */ 00066 00067 #if defined(STLSOFT_COMPILER_IS_WATCOM) 00068 00069 # include <wcvector.h> 00070 00071 #else /* ? compiler */ 00072 00073 # include <vector> 00074 00075 #endif /* compiler */ 00076 00077 /* ///////////////////////////////////////////////////////////////////////////// 00078 * Namespace 00079 */ 00080 00081 #if !defined(SHWILD_NO_NAMESPACE) 00082 namespace shwild 00083 { 00084 namespace impl 00085 { 00086 #endif /* !SHWILD_NO_NAMESPACE */ 00087 00088 /* ///////////////////////////////////////////////////////////////////////////// 00089 * Typedefs 00090 */ 00091 00098 template <class T> 00099 struct vector_maker 00100 { 00101 #if defined(STLSOFT_COMPILER_IS_WATCOM) 00102 class type 00103 : public WCValVector<T> 00104 { 00105 typedef WCValVector<T> parent_class_type; 00106 public: 00107 type() 00108 {} 00109 type(size_t length) 00110 : parent_class_type(length) 00111 {} 00112 00113 public: 00114 void push_back(T const &t) 00115 { 00116 static_cast<parent_class_type*>(this)->operator [](size()) = t; 00117 } 00118 00119 public: 00120 size_t size() const 00121 { 00122 return parent_class_type::length(); 00123 } 00124 }; 00125 #else /* ? compiler */ 00126 typedef std::vector<T> type; 00127 #endif /* compiler */ 00128 }; 00129 00130 /* ///////////////////////////////////////////////////////////////////////////// 00131 * Namespace 00132 */ 00133 00134 #if !defined(SHWILD_NO_NAMESPACE) 00135 } // namespace impl 00136 00137 } // namespace shwild 00138 00139 #endif /* !SHWILD_NO_NAMESPACE */ 00140 00141 /* ////////////////////////////////////////////////////////////////////////// */ 00142 00143 #endif /* !SHWILD_INCL_HPP_SHWILD_VECTORVECTOR */ 00144 00145 /* ////////////////////////////////////////////////////////////////////////// */
|
b64 Library documentation © Synesis Software Pty Ltd, 2004-2007 |