mirror of https://github.com/davisking/dlib.git
Changed code to compile in visual studio 2003
--HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403113
This commit is contained in:
parent
aa45ec812e
commit
ce01d75d1c
|
@ -764,7 +764,6 @@ namespace dlib
|
|||
and properly aligned to hold any kind of object.
|
||||
!*/
|
||||
public:
|
||||
|
||||
static const unsigned long size = bSIZE;
|
||||
|
||||
stack_based_memory_block(): data(mem.data) {}
|
||||
|
@ -782,6 +781,10 @@ namespace dlib
|
|||
!*/
|
||||
|
||||
private:
|
||||
|
||||
// You obviously can't have a block of memory that has zero bytes in it.
|
||||
COMPILE_TIME_ASSERT(bSIZE > 0);
|
||||
|
||||
union mem_block
|
||||
{
|
||||
// All of this garbage is to make sure this union is properly aligned
|
||||
|
|
|
@ -164,7 +164,13 @@ namespace dlib
|
|||
|
||||
protected:
|
||||
|
||||
stack_based_memory_block<sizeof(mp_null_impl)> mp_memory;
|
||||
// The reason for adding 1 here is because visual studio 2003 will sometimes
|
||||
// try to compile this code with sizeof(mp_null_impl) == 0 (which is a bug in visual studio).
|
||||
// Fortunately, no actual real instances of this template seem to end up with that screwed up
|
||||
// value so everything works fine if we just add 1 so that this degenerate case doesn't cause
|
||||
// trouble. Note that we know it all works fine because safe_clone() checks the size of this
|
||||
// memory block whenever the member function pointer is used.
|
||||
stack_based_memory_block<sizeof(mp_null_impl)+1> mp_memory;
|
||||
|
||||
void destroy_mp_memory (
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue