00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: stlsoft/shims/attribute/get_ptr/std/auto_ptr.hpp 00003 * 00004 * Purpose: Contains the get_ptr access shim. 00005 * 00006 * Created: 10th January 2002 00007 * Updated: 10th August 2009 00008 * 00009 * Thanks to: Nevin Liber for spotting a mistake in the get_ptr 00010 * definition. 00011 * 00012 * Home: http://stlsoft.org/ 00013 * 00014 * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software 00015 * All rights reserved. 00016 * 00017 * Redistribution and use in source and binary forms, with or without 00018 * modification, are permitted provided that the following conditions are met: 00019 * 00020 * - Redistributions of source code must retain the above copyright notice, this 00021 * list of conditions and the following disclaimer. 00022 * - Redistributions in binary form must reproduce the above copyright notice, 00023 * this list of conditions and the following disclaimer in the documentation 00024 * and/or other materials provided with the distribution. 00025 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00026 * any contributors may be used to endorse or promote products derived from 00027 * this software without specific prior written permission. 00028 * 00029 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00030 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00031 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00032 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00033 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00034 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00035 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00036 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00037 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00038 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00039 * POSSIBILITY OF SUCH DAMAGE. 00040 * 00041 * ////////////////////////////////////////////////////////////////////// */ 00042 00043 00050 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR 00051 #define STLSOFT_INCL_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR 00052 00053 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00054 # define STLSOFT_VER_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR_MAJOR 4 00055 # define STLSOFT_VER_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR_MINOR 1 00056 # define STLSOFT_VER_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR_REVISION 2 00057 # define STLSOFT_VER_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR_EDIT 49 00058 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00059 00060 /* ///////////////////////////////////////////////////////////////////////// 00061 * Includes 00062 */ 00063 00064 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT 00065 # include <stlsoft/stlsoft.h> 00066 #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */ 00067 00068 #if defined(STLSOFT_COMPILER_IS_WATCOM) 00069 # define _STLSOFT_PTR_ACCESS_NO_AUTO_PTR 00070 #endif /* compiler */ 00071 00072 #ifndef _STLSOFT_PTR_ACCESS_NO_AUTO_PTR 00073 # include <memory> // for std::auto_ptr 00074 #endif /* _STLSOFT_PTR_ACCESS_NO_AUTO_PTR */ 00075 00076 /* ///////////////////////////////////////////////////////////////////////// 00077 * Namespace 00078 */ 00079 00080 #ifndef _STLSOFT_NO_NAMESPACE 00081 namespace stlsoft 00082 { 00083 #endif /* _STLSOFT_NO_NAMESPACE */ 00084 00085 /* ///////////////////////////////////////////////////////////////////////// 00086 * get_ptr functions 00087 */ 00088 00089 #ifndef _STLSOFT_PTR_ACCESS_NO_AUTO_PTR 00090 00091 /* std::auto_ptr */ 00095 template <ss_typename_param_k T> 00096 inline T *get_ptr(stlsoft_ns_qual_std(auto_ptr)<T> const& p) 00097 { 00098 return p.get(); 00099 } 00100 00101 #endif /* _STLSOFT_PTR_ACCESS_NO_AUTO_PTR */ 00102 00104 // Unit-testing 00105 00106 #ifdef STLSOFT_UNITTEST 00107 # include "./unittest/auto_ptr_unittest_.h" 00108 #endif /* STLSOFT_UNITTEST */ 00109 00110 /* ////////////////////////////////////////////////////////////////////// */ 00111 00112 #ifndef _STLSOFT_NO_NAMESPACE 00113 } // namespace stlsoft 00114 #endif /* _STLSOFT_NO_NAMESPACE */ 00115 00116 /* ////////////////////////////////////////////////////////////////////// */ 00117 00118 #endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ATTRIBUTE_GET_PTR_STD_HPP_AUTO_PTR */ 00119 00120 /* ///////////////////////////// end of file //////////////////////////// */