|
|
|||
File indexing completed on 2026-09-13 09:17:16
0001 // Created on: 2015-06-26 0002 // Created by: Andrey Betenev 0003 // Copyright (c) 2015 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef NCollection_Shared_HeaderFile 0017 #define NCollection_Shared_HeaderFile 0018 0019 #include <NCollection_DefineAlloc.hxx> 0020 0021 //! Template defining a class derived from the specified base class and 0022 //! Standard_Transient, and supporting OCCT RTTI. 0023 //! 0024 //! This provides possibility to use Handes for types not initially intended 0025 //! to be dynamically allocated. 0026 //! 0027 //! Current limitation is that only copy and constructors with 1-3 arguments are defined, 0028 //! calling those of the argument class (default constructor must be available). 0029 //! It can be improved when perfect forwarding of template arguments is supported 0030 //! by all compilers used for OCCT. 0031 //! 0032 //! The intent is similar to std::make_shared<> in STL, except that this 0033 //! implementation defines a separate type. 0034 0035 template <class T, 0036 typename = typename opencascade::std::enable_if< 0037 !opencascade::std::is_base_of<Standard_Transient, T>::value>::type> 0038 class NCollection_Shared : public Standard_Transient, public T 0039 { 0040 public: 0041 DEFINE_STANDARD_ALLOC 0042 DEFINE_NCOLLECTION_ALLOC 0043 0044 //! Default constructor 0045 NCollection_Shared() = default; 0046 0047 //! Constructor with single argument 0048 template <typename T1> 0049 NCollection_Shared(const T1& arg1) 0050 : T(arg1) 0051 { 0052 } 0053 0054 //! Constructor with single argument 0055 template <typename T1> 0056 NCollection_Shared(T1& arg1) 0057 : T(arg1) 0058 { 0059 } 0060 0061 //! Constructor with two arguments 0062 template <typename T1, typename T2> 0063 NCollection_Shared(const T1& arg1, const T2& arg2) 0064 : T(arg1, arg2) 0065 { 0066 } 0067 0068 //! Constructor with two arguments 0069 template <typename T1, typename T2> 0070 NCollection_Shared(T1& arg1, const T2& arg2) 0071 : T(arg1, arg2) 0072 { 0073 } 0074 0075 //! Constructor with two arguments 0076 template <typename T1, typename T2> 0077 NCollection_Shared(const T1& arg1, T2& arg2) 0078 : T(arg1, arg2) 0079 { 0080 } 0081 0082 //! Constructor with two arguments 0083 template <typename T1, typename T2> 0084 NCollection_Shared(T1& arg1, T2& arg2) 0085 : T(arg1, arg2) 0086 { 0087 } 0088 0089 /* this could work... 0090 //! Forwarding constructor 0091 template<typename... Args> 0092 NCollection_Shared (Args&&... args) 0093 : T (std::forward<Args>(args)...) 0094 {} 0095 */ 0096 }; 0097 0098 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|