Changed: Use stdext::make_checked_array_iterator and stdext::make_unchecked_array_iterator with VC++ 2015

--HG--
branch : develop
This commit is contained in:
kervala 2016-11-20 13:25:24 +01:00
parent 0e25d31f30
commit 48088d651e
6 changed files with 24 additions and 2 deletions

View file

@ -24,6 +24,8 @@
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/misc/traits_nl.h" #include "nel/misc/traits_nl.h"
#include <iterator>
namespace NL3D { namespace NL3D {
/* /*
@ -480,7 +482,11 @@ void CPSValueGradientFunc<T>::setValuesUnpacked(const T *valueTab, uint32 numVal
_MaxValue = _MinValue = valueTab[0]; _MaxValue = _MinValue = valueTab[0];
_NbValues = (numValues - 1) * nbStages; _NbValues = (numValues - 1) * nbStages;
_Tab.resize(_NbValues + 1); _Tab.resize(_NbValues + 1);
#ifdef NL_COMP_VC14
std::copy(valueTab, valueTab + _NbValues + 1, stdext::make_checked_array_iterator(&_Tab[0], _Tab.size()));
#else
std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]); std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]);
#endif
} }

View file

@ -1101,7 +1101,11 @@ bool CMeshGeom::retrieveTriangles(std::vector<uint32> &indices) const
else else
{ {
// std::copy will convert from 16 bits index to 32 bit index // std::copy will convert from 16 bits index to 32 bit index
std::copy((uint16 *) iba.getPtr(), ((uint16 *) iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx*3]); #ifdef NL_COMP_VC14
std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), stdext::make_checked_array_iterator(&indices[triIdx * 3], indices.size() - triIdx * 3));
#else
std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx * 3]);
#endif
} }
// next // next
triIdx+= pb.getNumIndexes()/3; triIdx+= pb.getNumIndexes()/3;

View file

@ -1113,6 +1113,9 @@ void CPSConstraintMesh::getShapesNames(std::string *shapesNames) const
{ {
const_cast<CPSConstraintMesh *>(this)->update(); const_cast<CPSConstraintMesh *>(this)->update();
} }
#ifdef NL_COMP_VC14
std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), stdext::make_unchecked_array_iterator(shapesNames));
#else
std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), shapesNames); std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), shapesNames);
} }

View file

@ -1463,7 +1463,11 @@ void CPSRibbon::setShape(const CVector *shape, uint32 nbPointsInShape, bool brac
///================================================================================================================== ///==================================================================================================================
void CPSRibbon::getShape(CVector *shape) const void CPSRibbon::getShape(CVector *shape) const
{ {
NL_PS_FUNC(CPSRibbon_getShape) NL_PS_FUNC(CPSRibbon_getShape);
#ifdef NL_COMP_VC14
std::copy(_Shape.begin(), _Shape.end(), stdext::make_unchecked_array_iterator(shape));
#else
std::copy(_Shape.begin(), _Shape.end(), shape); std::copy(_Shape.begin(), _Shape.end(), shape);
} }

View file

@ -34,6 +34,7 @@
#include <functional> #include <functional>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <iterator>
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"

View file

@ -305,7 +305,11 @@ void CWaterHeightMap::makeCpy(uint buffer, uint dX, uint dY, uint sX, uint sY,
{ {
if (dest < src) if (dest < src)
{ {
#ifdef NL_COMP_VC14
std::copy(src, src + width, stdext::make_unchecked_array_iterator(dest));
#else
std::copy(src, src + width, dest); std::copy(src, src + width, dest);
#endif
} }
else else
{ {