mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0032352: Coding Rules - clean up code from compatibility hacks with pre-C++11 compilers
Removed usage of std::auto_ptr. opencascade::std workarounds for VS2008 have been dropped, when possible. OCCT_NO_RVALUE_REFERENCE workaround for VS2008 has been removed.
This commit is contained in:
@@ -70,13 +70,11 @@ namespace opencascade {
|
||||
BeginScope();
|
||||
}
|
||||
|
||||
#ifndef OCCT_NO_RVALUE_REFERENCE
|
||||
//! Move constructor
|
||||
handle (handle&& theHandle) : entity(theHandle.entity)
|
||||
{
|
||||
theHandle.entity = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Destructor
|
||||
~handle ()
|
||||
@@ -113,14 +111,12 @@ namespace opencascade {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef OCCT_NO_RVALUE_REFERENCE
|
||||
//! Move operator
|
||||
handle& operator= (handle&& theHandle)
|
||||
{
|
||||
std::swap (this->entity, theHandle.entity);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! STL-like cast to pointer to referred object (note non-const).
|
||||
//! @sa std::shared_ptr::get()
|
||||
@@ -307,7 +303,6 @@ namespace opencascade {
|
||||
BeginScope();
|
||||
}
|
||||
|
||||
#ifndef OCCT_NO_RVALUE_REFERENCE
|
||||
//! Generalized move constructor
|
||||
template <class T2>
|
||||
handle (handle<T2>&& theHandle, typename std::enable_if <is_base_but_not_same <T, T2>::value>::type* = nullptr)
|
||||
@@ -315,7 +310,6 @@ namespace opencascade {
|
||||
{
|
||||
theHandle.entity = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Generalized assignment operator.
|
||||
template <class T2>
|
||||
@@ -327,7 +321,6 @@ namespace opencascade {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef OCCT_NO_RVALUE_REFERENCE
|
||||
//! Generalized move operator
|
||||
template <class T2>
|
||||
handle& operator= (handle<T2>&& theHandle)
|
||||
@@ -337,7 +330,6 @@ namespace opencascade {
|
||||
std::swap (this->entity, theHandle.entity);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
|
@@ -20,13 +20,17 @@
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
# define _Standard_Macro_HeaderFile
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
#error C++11 compatible compiler is required (Visual Studio 2010 or newer)
|
||||
#endif
|
||||
|
||||
//! @def Standard_OVERRIDE
|
||||
//! Should be used in declarations of virtual methods overridden in the
|
||||
//! derived classes, to cause compilation error in the case if that virtual
|
||||
//! function disappears or changes its signature in the base class.
|
||||
//!
|
||||
//! Expands to C++11 keyword "override" on compilers that are known to
|
||||
//! suppot it; empty in other cases.
|
||||
//! support it; empty in other cases.
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201100L)
|
||||
// part of C++11 standard
|
||||
#define Standard_OVERRIDE override
|
||||
@@ -183,13 +187,6 @@
|
||||
#define Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
//! @def OCCT_NO_RVALUE_REFERENCE
|
||||
//! Disables methods and constructors that use rvalue references
|
||||
//! (C++11 move semantics) not supported by obsolete compilers.
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
#define OCCT_NO_RVALUE_REFERENCE
|
||||
#endif
|
||||
|
||||
# ifdef _WIN32
|
||||
|
||||
// We must be careful including windows.h: it is really poisonous stuff!
|
||||
|
@@ -33,37 +33,6 @@ namespace opencascade
|
||||
// import all available standard stuff from std namespace
|
||||
using namespace ::std;
|
||||
|
||||
// for old MSVC compiler, some standard templates are defined in std::tr1 namespace,
|
||||
// and some missing ones are implemented here
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
using namespace ::std::tr1;
|
||||
|
||||
// C++11 template class enable_if
|
||||
template <bool Test, class Type = void>
|
||||
struct enable_if
|
||||
{ // type is undefined for assumed !_Test
|
||||
};
|
||||
|
||||
template <class _Type>
|
||||
struct enable_if<true, _Type>
|
||||
{ // type is _Type for _Test
|
||||
typedef _Type type;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
//! Trait yielding true if class T1 is base of T2 but not the same
|
||||
|
@@ -63,11 +63,6 @@ namespace opencascade
|
||||
static_assert(opencascade::has_type<Base, direct_base_classes>::type::value, "OCCT RTTI definition is incorrect: " #Base " is not direct base class of " #Class); \
|
||||
static_assert(&get_type_name == &Class::get_type_name, "OCCT RTTI definition is misplaced: current class is not " #Class);
|
||||
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
|
||||
// VC9 does not support static_assert and decltype at all
|
||||
#define OCCT_CHECK_BASE_CLASS(Class,Base)
|
||||
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1900))
|
||||
|
||||
// VC14+ allow using address of member functions in static checks,
|
||||
|
@@ -18,21 +18,7 @@
|
||||
#include <cstddef>
|
||||
#include <ctime>
|
||||
|
||||
// VC9 does not have stdint.h
|
||||
#if(defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
// old MSVC - hasn't stdint header
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#if(defined(_MSC_VER) && (_MSC_VER < 1800))
|
||||
// only Visual Studio 2013 (vc12) provides <cinttypes> header
|
||||
|
Reference in New Issue
Block a user