XDispatch 0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
pointer.h
Go to the documentation of this file.
00001 
00002 /*
00003 * Copyright (c) 2012 MLBA-Team. All rights reserved.
00004 *
00005 * @MLBA_OPEN_LICENSE_HEADER_START@
00006 *
00007 * Licensed under the Apache License, Version 2.0 (the "License");
00008 * you may not use this file except in compliance with the License.
00009 * You may obtain a copy of the License at
00010 *
00011 *     http://www.apache.org/licenses/LICENSE-2.0
00012 *
00013 * Unless required by applicable law or agreed to in writing, software
00014 * distributed under the License is distributed on an "AS IS" BASIS,
00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 * See the License for the specific language governing permissions and
00017 * limitations under the License.
00018 *
00019 * @MLBA_OPEN_LICENSE_HEADER_END@
00020 */
00021 
00022 
00023 #ifndef XDISPATCH_SCOPED_PTER_H_
00024 #define XDISPATCH_SCOPED_PTER_H_
00025 
00031 #ifndef __XDISPATCH_INDIRECT__
00032 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00033 #endif
00034 
00035 // Note: This header provides some memory management classes
00036 //       by importing means provided by the STL into the xdispatch
00037 //       namespace. Although it is perfectly clear that the new unique_ptr
00038 //       differs from the old auto_ptr, it is ok to mix them regarding the
00039 //       way they are used within xdispatch
00040 
00041 // MSVC 2010
00042 #if _MSC_VER >= 1600
00043 
00044 # include <memory>
00045 
00046 __XDISPATCH_BEGIN_NAMESPACE
00047 
00048 template < typename _Type >
00049 struct pointer {
00050 
00051     typedef ::std::auto_ptr< _Type > unique;
00052     typedef ::std::shared_ptr< _Type > shared;
00053     typedef ::std::weak_ptr< _Type > weak;
00054 
00055 };
00056 
00057 __XDISPATCH_END_NAMESPACE
00058 
00059 // MSVC 2008
00060 #elif _MSC_VER >= 1500
00061 
00062 # include <memory>
00063 
00064 __XDISPATCH_BEGIN_NAMESPACE
00065 
00066 template < typename _Type >
00067 struct pointer {
00068 
00069     typedef ::std::auto_ptr< _Type > unique;
00070        typedef ::std::tr1::shared_ptr< _Type > shared;
00071     typedef ::std::tr1::weak_ptr< _Type > weak;
00072 
00073 };
00074 
00075 __XDISPATCH_END_NAMESPACE
00076 
00077 // gcc 4.5+ with c++0x enabled
00078 #elif defined __GXX_EXPERIMENTAL_CXX0X_
00079 
00080 # include <memory>
00081 
00082 __XDISPATCH_BEGIN_NAMESPACE
00083 
00084 template < typename _Type >
00085 struct pointer {
00086 
00087     // although we have std::unique_ptr, we cannot use it
00088     // as this would mean different sizes whenever mixing
00089     // clang and gcc
00090     typedef ::std::auto_ptr< _Type > unique;
00091     typedef ::std::shared_ptr< _Type > shared;
00092     typedef ::std::weak_ptr< _Type > weak;
00093 
00094 };
00095 
00096 __XDISPATCH_END_NAMESPACE
00097 
00098 #else // all others
00099 
00100 # include <memory>
00101 # include <tr1/memory>
00102 
00103 __XDISPATCH_BEGIN_NAMESPACE
00104 
00105 template < typename _Type >
00106 struct pointer {
00107 
00108     typedef ::std::auto_ptr< _Type > unique;
00109     typedef ::std::tr1::shared_ptr< _Type > shared;
00110     typedef ::std::tr1::weak_ptr< _Type > weak;
00111 
00112 };
00113 
00114 __XDISPATCH_END_NAMESPACE
00115 
00116 #endif
00117 
00120 #endif /* XDISPATCH_SCOPED_PTER_H_ */
00121 

Generated on Tue Jun 12 2012 14:11:47 for XDispatch by Doxygen 1.8.0
© 2010-2012 MLBA (about | privacy) All Rights reserved.