- Joined
- Nov 17, 2013
- Messages
- 158
- Reaction score
- 9
yes to, then why use 2008? : D
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
#pragma once
// compile time assert
#ifdef __cplusplus
#define JOIN( X, Y ) JOIN2(X,Y)
#define JOIN2( X, Y ) X##Y
namespace assert_static
{
template <bool> struct STATIC_ASSERT_FAILURE;
template <> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
template<int x> struct static_assert_test{};
}
#define COMPILE_ASSERT(x) \
typedef ::assert_static::static_assert_test<\
sizeof(::assert_static::STATIC_ASSERT_FAILURE< (bool)( x ) >)>\
JOIN(_static_assert_typedef, __LINE__)
#else // __cplusplus
#define COMPILE_ASSERT(x) extern int __dummy[(int)x]
#endif // __cplusplus
#define VERIFY_EXPLICIT_CAST(from, to) COMPILE_ASSERT(sizeof(from) == sizeof(to))
//=========================================================================
// Module: r3dSTLAllocators.h
//=========================================================================
#if _MSC_VER > 1000 /*IFSTRIP=IGN*/
#pragma once
#endif
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
#include <limits>
#ifndef _FARQ /* specify standard memory model */
#define _FARQ
#define _PDFT ptrdiff_t
#define _SIZT size_t
#endif
#define _POINTER_X(T, A) T _FARQ *
#define _REFERENCE_X(T, A) T _FARQ &
//////////////////////////////////////////////////////////////////////////
template <typename T, int AT>
class r3dSTLCustomAllocator
{
public:
//type definitions
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef T value_type;
//rebind allocator to type U
template <class U>
struct rebind
{
typedef r3dSTLCustomAllocator<U, AT> other;
};
//return address of values
pointer address (reference value) const
{
return &value;
}
const_pointer address (const_reference value) const
{
return &value;
}
/*constructors and destructor
*-nothing to do because the allocator has no state
*/
r3dSTLCustomAllocator() throw() {}
r3dSTLCustomAllocator(const r3dSTLCustomAllocator&) throw() {}
template <class U>
r3dSTLCustomAllocator (const r3dSTLCustomAllocator<U, AT>&) throw() {}
~r3dSTLCustomAllocator() throw() {}
//return maximum number of elements that can be allocated
size_type max_size () const throw()
{
//for numeric_limits see Section 4.3, page 59
return std::numeric_limits<size_t>::max() / sizeof(T);
}
//allocate but don't initialize num elements of type T
pointer allocate (size_type num, typename r3dSTLCustomAllocator<void, AT>::const_pointer hint = 0)
{
//allocate memory with global new
return (pointer) r3dAllocateMemory(num * sizeof(T), 1, static_cast<r3dAllocationTypes>(AT));
}
//initialize elements of allocated storage p with value value
void construct (pointer p, const T& value)
{
//initialize memory with placement new
new((void*)p)T(value);
}
//destroy elements of initialized storage p
void destroy (pointer p)
{
// destroy objects by calling their destructor
p->~T();
}
//deallocate storage p of deleted elements
void deallocate (pointer p, size_type num)
{
//deallocate memory with global delete
r3dDeallocateMemory(p, 1, static_cast<r3dAllocationTypes>(AT));
}
};
//return that all specializations of this allocator are interchangeable
template <class T1, class T2, int AT>
bool operator== (const r3dSTLCustomAllocator<T1, AT>&,
const r3dSTLCustomAllocator<T2, AT>&) throw()
{
return true;
}
template <class T1, class T2, int AT>
bool operator!= (const r3dSTLCustomAllocator<T1, AT>&,
const r3dSTLCustomAllocator<T2, AT>&) throw()
{
return false;
}
//////////////////////////////////////////////////////////////////////////
template<int AT>
class r3dSTLCustomAllocator<void, AT>
{ // allocator for type void
public:
typedef void _Ty;
typedef _Ty _FARQ *pointer;
typedef const _Ty _FARQ *const_pointer;
typedef _Ty value_type;
template<class _Other>
struct rebind
{ // convert an allocator<void> to an allocator <_Other>
typedef r3dSTLCustomAllocator<_Other, AT> other;
};
r3dSTLCustomAllocator() _THROW0()
{ // construct default allocator (do nothing)
}
r3dSTLCustomAllocator(const r3dSTLCustomAllocator<_Ty, AT>&) _THROW0()
{ // construct by copying (do nothing)
}
template<class _Other>
r3dSTLCustomAllocator(const r3dSTLCustomAllocator<_Other, AT>&) _THROW0()
{ // construct from related allocator (do nothing)
}
template<class _Other>
r3dSTLCustomAllocator<_Ty, AT>& operator=(const r3dSTLCustomAllocator<_Other, AT>&)
{ // assign from a related allocator (do nothing)
return (*this);
}
};
still will have issues with AutodeskNav\lib as they where compiled with vs2008....
Not having to use the ugly buggy slow turtle piece of crap is already a valid reason for me.If u're using 2008 as Platform, there is no profit from the newer compiler etc.
If u're using 2008 as Platform, there is no profit from the newer compiler etc.
I'm trying it with Visual Studio 2015, I'll let you know if it works.
Just a note, for who want to try, it works on VS2012.