mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028824: Possibility to build OCCT 7.1.0 and above using Visual Studio 2008
Possibility to build OCCT using Visual Studio 2008 (VC9) is restored. For that: - template functions and classes from namespace std or tr1 (for VC9) are imported to namespace opencascade which is then used instead of std in relevant places - templates not provided by compiler (VC9) but required for OCCT are defined in this namespace (in Standard_Handle.hxx) - methods implementing move semantics are excluded for VC9 compiler (which does not support && syntax) - support of vc9 compiler is restored in build procedures and environment scripts - check of type of the current class in macros DEFINE_STANDARD_RTTI* is refactored VS 2008 is restored in the list of supported platforms on Overview / System Requirements.
This commit is contained in:
@@ -192,6 +192,8 @@ public:
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
#if(defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
#else
|
||||
NCollection_Array1 (NCollection_Array1&& theOther)
|
||||
: myLowerBound (theOther.myLowerBound),
|
||||
myUpperBound (theOther.myUpperBound),
|
||||
@@ -202,6 +204,7 @@ public:
|
||||
theOther.myDeletable = false;
|
||||
theOther.myData = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! C array-based constructor
|
||||
NCollection_Array1 (const TheItemType& theBegin,
|
||||
@@ -279,7 +282,7 @@ public:
|
||||
}
|
||||
|
||||
//! Move assignment
|
||||
NCollection_Array1& Move (NCollection_Array1&& theOther)
|
||||
NCollection_Array1& Move (NCollection_Array1& theOther)
|
||||
{
|
||||
if (&theOther == this)
|
||||
{
|
||||
@@ -308,10 +311,13 @@ public:
|
||||
}
|
||||
|
||||
//! Move assignment operator.
|
||||
#if(defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
#else
|
||||
NCollection_Array1& operator= (NCollection_Array1&& theOther)
|
||||
{
|
||||
return Move (std::move (theOther));
|
||||
return Move (theOther);
|
||||
}
|
||||
#endif
|
||||
|
||||
//! @return first element
|
||||
const TheItemType& First() const
|
||||
|
@@ -41,7 +41,7 @@ class HClassName : public _SequenceType_, public Standard_Transient {
|
||||
_SequenceType_& ChangeSequence () { return *this; } \
|
||||
template <class T> \
|
||||
void Append (const Handle(T)& theOther, \
|
||||
typename std::enable_if<std::is_base_of<HClassName, T>::value>::type * = 0) { \
|
||||
typename opencascade::std::enable_if<opencascade::std::is_base_of<HClassName, T>::value>::type * = 0) { \
|
||||
_SequenceType_::Append (theOther->ChangeSequence()); \
|
||||
} \
|
||||
DEFINE_STANDARD_RTTI_INLINE(HClassName,Standard_Transient) \
|
||||
|
@@ -32,7 +32,7 @@
|
||||
//! The intent is similar to std::make_shared<> in STL, except that this
|
||||
//! implementation defines a separate type.
|
||||
|
||||
template <class T, typename = typename std::enable_if<! std::is_base_of<Standard_Transient, T>::value>::type>
|
||||
template <class T, typename = typename opencascade::std::enable_if<! opencascade::std::is_base_of<Standard_Transient, T>::value>::type>
|
||||
class NCollection_Shared : public Standard_Transient, public T
|
||||
{
|
||||
public:
|
||||
|
@@ -19,48 +19,6 @@
|
||||
#include <Standard_Assert.hxx>
|
||||
#include <iterator>
|
||||
|
||||
// This file uses C++11 utilities like std::is_base<>, which are not
|
||||
// available in some environments (e.g. MSVC includes them since VS 2008).
|
||||
// Hence here we define our own implementation of these tools in namespace opencascade.
|
||||
// When all compilers support this, this namespace can be removed and replaced by std.
|
||||
namespace opencascade
|
||||
{
|
||||
template<bool Condition, typename T>
|
||||
struct enable_if
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enable_if<false, T>
|
||||
{
|
||||
};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct is_same
|
||||
{
|
||||
enum { value = 0 };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_same<T, T>
|
||||
{
|
||||
enum { value = 1 };
|
||||
};
|
||||
|
||||
template<bool Condition, typename TypeTrue, typename TypeFalse>
|
||||
struct conditional
|
||||
{
|
||||
typedef TypeTrue type;
|
||||
};
|
||||
|
||||
template<typename TypeTrue, typename TypeFalse>
|
||||
struct conditional<false, TypeTrue, TypeFalse>
|
||||
{
|
||||
typedef TypeFalse type;
|
||||
};
|
||||
}
|
||||
|
||||
//! Helper class that allows to use NCollection iterators as STL iterators.
|
||||
//! NCollection iterator can be extended to STL iterator of any category by
|
||||
//! adding necessary methods: STL forward iterator requires IsEqual method,
|
||||
@@ -70,8 +28,8 @@ namespace opencascade
|
||||
template<class Category, class BaseIterator, class ItemType, bool IsConstant>
|
||||
class NCollection_StlIterator :
|
||||
public std::iterator<Category, ItemType, ptrdiff_t,
|
||||
typename opencascade::conditional<IsConstant, const ItemType*, ItemType*>::type,
|
||||
typename opencascade::conditional<IsConstant, const ItemType&, ItemType&>::type>
|
||||
typename opencascade::std::conditional<IsConstant, const ItemType*, ItemType*>::type,
|
||||
typename opencascade::std::conditional<IsConstant, const ItemType&, ItemType&>::type>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -113,13 +71,13 @@ protected: //! @name methods related to forward STL iterator
|
||||
// an appropriate method based on template arguments (at instantiation time).
|
||||
|
||||
template<bool Condition>
|
||||
typename opencascade::enable_if<!Condition, ItemType&>::type Reference() const
|
||||
typename opencascade::std::enable_if<!Condition, ItemType&>::type Reference() const
|
||||
{
|
||||
return myIterator.ChangeValue();
|
||||
}
|
||||
|
||||
template<bool Condition>
|
||||
typename opencascade::enable_if<Condition, const ItemType&>::type Reference() const
|
||||
typename opencascade::std::enable_if<Condition, const ItemType&>::type Reference() const
|
||||
{
|
||||
return myIterator.Value();
|
||||
}
|
||||
@@ -171,8 +129,8 @@ public: //! @name methods related to bidirectional STL iterator
|
||||
//! Prefix decrement
|
||||
NCollection_StlIterator& operator--()
|
||||
{
|
||||
Standard_STATIC_ASSERT((opencascade::is_same<std::bidirectional_iterator_tag,Category>::value ||
|
||||
opencascade::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
Standard_STATIC_ASSERT((opencascade::std::is_same<std::bidirectional_iterator_tag,Category>::value ||
|
||||
opencascade::std::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
myIterator.Previous();
|
||||
return *this;
|
||||
}
|
||||
@@ -190,7 +148,7 @@ public: //! @name methods related to random access STL iterator
|
||||
//! Move forward
|
||||
NCollection_StlIterator& operator+= (typename NCollection_StlIterator::difference_type theOffset)
|
||||
{
|
||||
Standard_STATIC_ASSERT((opencascade::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
Standard_STATIC_ASSERT((opencascade::std::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
myIterator.Offset (theOffset);
|
||||
return *this;
|
||||
}
|
||||
@@ -218,7 +176,7 @@ public: //! @name methods related to random access STL iterator
|
||||
//! Difference
|
||||
typename NCollection_StlIterator::difference_type operator- (const NCollection_StlIterator& theOther) const
|
||||
{
|
||||
Standard_STATIC_ASSERT((opencascade::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
Standard_STATIC_ASSERT((opencascade::std::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
return myIterator.Differ (theOther.myIterator);
|
||||
}
|
||||
|
||||
|
@@ -130,7 +130,7 @@ template <class TheObjType, class TheBndType> class NCollection_UBTreeFiller
|
||||
|
||||
UBTree& myTree;
|
||||
NCollection_Vector<ObjBnd> mySeqPtr;
|
||||
std::mt19937 myRandGen; //!< random number generator
|
||||
opencascade::std::mt19937 myRandGen; //!< random number generator
|
||||
Standard_Boolean myIsFullRandom;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user