![]() |
![]() |
|
00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: src/shwild_vector.hpp 00003 * 00004 * Purpose: vector class for shwild implementation 00005 * 00006 * Created: 17th June 2005 00007 * Updated: 20th December 2011 00008 * 00009 * Home: http://shwild.org/ 00010 * 00011 * Copyright (c) 2005-2011, 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 00016 * met: 00017 * 00018 * - Redistributions of source code must retain the above copyright notice, 00019 * this list of conditions and the following disclaimer. 00020 * - Redistributions in binary form must reproduce the above copyright 00021 * notice, this list of conditions and the following disclaimer in the 00022 * documentation and/or other materials provided with the distribution. 00023 * - Neither the names of Matthew Wilson and Sean Kelly nor the names of 00024 * any contributors may be used to endorse or promote products derived 00025 * from this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00028 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00029 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00030 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00031 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00032 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00033 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00034 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00035 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00036 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00037 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00038 * 00039 * ////////////////////////////////////////////////////////////////////// */ 00040 00041 00042 #ifndef SHWILD_INCL_HPP_SHWILD_VECTORVECTOR 00043 #define SHWILD_INCL_HPP_SHWILD_VECTORVECTOR 00044 00045 /* ///////////////////////////////////////////////////////////////////////// 00046 * Includes 00047 */ 00048 00049 #include <shwild/shwild.h> 00050 #include "shwild_stlsoft.h" 00051 00052 #if defined(STLSOFT_COMPILER_IS_WATCOM) 00053 00054 # include <wcvector.h> 00055 00056 #else /* ? compiler */ 00057 00058 # include <vector> 00059 00060 #endif /* compiler */ 00061 00062 /* ///////////////////////////////////////////////////////////////////////// 00063 * Namespace 00064 */ 00065 00066 #if !defined(SHWILD_NO_NAMESPACE) 00067 namespace shwild 00068 { 00069 namespace impl 00070 { 00071 #endif /* !SHWILD_NO_NAMESPACE */ 00072 00073 /* ///////////////////////////////////////////////////////////////////////// 00074 * Typedefs 00075 */ 00076 00083 template <class T> 00084 struct vector_maker 00085 { 00086 #if defined(STLSOFT_COMPILER_IS_WATCOM) 00087 class type 00088 : public WCValVector<T> 00089 { 00090 typedef WCValVector<T> parent_class_type; 00091 public: 00092 type() 00093 {} 00094 type(size_t length) 00095 : parent_class_type(length) 00096 {} 00097 00098 public: 00099 void push_back(T const &t) 00100 { 00101 static_cast<parent_class_type*>(this)->operator [](size()) = t; 00102 } 00103 00104 public: 00105 size_t size() const 00106 { 00107 return parent_class_type::length(); 00108 } 00109 }; 00110 #else /* ? compiler */ 00111 typedef std::vector<T> type; 00112 #endif /* compiler */ 00113 }; 00114 00115 /* ///////////////////////////////////////////////////////////////////////// 00116 * Namespace 00117 */ 00118 00119 #if !defined(SHWILD_NO_NAMESPACE) 00120 } // namespace impl 00121 00122 } // namespace shwild 00123 00124 #endif /* !SHWILD_NO_NAMESPACE */ 00125 00126 /* ////////////////////////////////////////////////////////////////////// */ 00127 00128 #endif /* !SHWILD_INCL_HPP_SHWILD_VECTORVECTOR */ 00129 00130 /* ///////////////////////////// end of file //////////////////////////// */
|
b64 Library documentation © Synesis Software Pty Ltd, 2004-2012 |