Replaced boost::tuple with std::tuple

pull/850/head
mensinda 2016-04-06 00:17:21 +02:00
parent b37e25cd7d
commit ae99f99b99
8 changed files with 37 additions and 40 deletions

View File

@ -636,7 +636,7 @@ void ColladaExporter::WriteMaterials()
aiString name; aiString name;
if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS ) if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
name = "mat"; name = "mat";
materials[a].name = std::string( "m") + boost::lexical_cast<std::string> (a) + name.C_Str(); materials[a].name = std::string( "m") + std::to_string(a) + name.C_Str();
for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) { for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) {
if( !isalnum_C( *it ) ) { if( !isalnum_C( *it ) ) {
*it = '_'; *it = '_';
@ -812,7 +812,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
{ {
if( mesh->HasTextureCoords( a) ) if( mesh->HasTextureCoords( a) )
{ {
WriteFloatArray( idstr + "-tex" + boost::lexical_cast<std::string> (a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2, WriteFloatArray( idstr + "-tex" + std::to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
(float*) mesh->mTextureCoords[a], mesh->mNumVertices); (float*) mesh->mTextureCoords[a], mesh->mNumVertices);
} }
} }
@ -821,7 +821,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
{ {
if( mesh->HasVertexColors( a) ) if( mesh->HasVertexColors( a) )
WriteFloatArray( idstr + "-color" + boost::lexical_cast<std::string> (a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices); WriteFloatArray( idstr + "-color" + std::to_string(a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices);
} }
// assemble vertex structure // assemble vertex structure

View File

@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <map> #include <map>
#include <boost/lexical_cast.hpp>
struct aiScene; struct aiScene;
struct aiNode; struct aiNode;
@ -123,7 +122,7 @@ protected:
void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); } void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); }
/// Creates a mesh ID for the given mesh /// Creates a mesh ID for the given mesh
std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + boost::lexical_cast<std::string> (pIndex); } std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + std::to_string(pIndex); }
public: public:
/// Stringstream to write all output into /// Stringstream to write all output into

View File

@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StringComparison.h" #include "StringComparison.h"
#include "../include/assimp/scene.h" #include "../include/assimp/scene.h"
#include <boost/tuple/tuple.hpp> #include <tuple>
#include <memory> #include <memory>
#include <iterator> #include <iterator>
@ -338,7 +338,7 @@ private:
bool reverse_order = false ); bool reverse_order = false );
// key (time), value, mapto (component index) // key (time), value, mapto (component index)
typedef boost::tuple<std::shared_ptr<KeyTimeList>, std::shared_ptr<KeyValueList>, unsigned int > KeyFrameList; typedef std::tuple<std::shared_ptr<KeyTimeList>, std::shared_ptr<KeyValueList>, unsigned int > KeyFrameList;
typedef std::vector<KeyFrameList> KeyFrameListList; typedef std::vector<KeyFrameList> KeyFrameListList;
@ -2966,7 +2966,7 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
} }
} }
inputs.push_back( boost::make_tuple( Keys, Values, mapto ) ); inputs.push_back( std::make_tuple( Keys, Values, mapto ) );
} }
} }
return inputs; // pray for NRVO :-) return inputs; // pray for NRVO :-)
@ -2984,7 +2984,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
size_t estimate = 0; size_t estimate = 0;
for( const KeyFrameList& kfl : inputs ) { for( const KeyFrameList& kfl : inputs ) {
estimate = std::max( estimate, kfl.get<0>()->size() ); estimate = std::max( estimate, std::get<0>(kfl)->size() );
} }
keys.reserve( estimate ); keys.reserve( estimate );
@ -2999,8 +2999,8 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
for ( size_t i = 0; i < count; ++i ) { for ( size_t i = 0; i < count; ++i ) {
const KeyFrameList& kfl = inputs[ i ]; const KeyFrameList& kfl = inputs[ i ];
if ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) < min_tick ) { if ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) < min_tick ) {
min_tick = kfl.get<0>()->at( next_pos[ i ] ); min_tick = std::get<0>(kfl)->at( next_pos[ i ] );
} }
} }
@ -3013,7 +3013,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
const KeyFrameList& kfl = inputs[ i ]; const KeyFrameList& kfl = inputs[ i ];
while ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == min_tick ) { while ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == min_tick ) {
++next_pos[ i ]; ++next_pos[ i ];
} }
} }
@ -3042,8 +3042,8 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
for ( size_t i = 0; i < count; ++i ) { for ( size_t i = 0; i < count; ++i ) {
const KeyFrameList& kfl = inputs[ i ]; const KeyFrameList& kfl = inputs[ i ];
const size_t ksize = kfl.get<0>()->size(); const size_t ksize = std::get<0>(kfl)->size();
if ( ksize > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == time ) { if ( ksize > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == time ) {
++next_pos[ i ]; ++next_pos[ i ];
} }
@ -3051,18 +3051,18 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
const size_t id1 = next_pos[ i ] == ksize ? ksize - 1 : next_pos[ i ]; const size_t id1 = next_pos[ i ] == ksize ? ksize - 1 : next_pos[ i ];
// use lerp for interpolation // use lerp for interpolation
const KeyValueList::value_type valueA = kfl.get<1>()->at( id0 ); const KeyValueList::value_type valueA = std::get<1>(kfl)->at( id0 );
const KeyValueList::value_type valueB = kfl.get<1>()->at( id1 ); const KeyValueList::value_type valueB = std::get<1>(kfl)->at( id1 );
const KeyTimeList::value_type timeA = kfl.get<0>()->at( id0 ); const KeyTimeList::value_type timeA = std::get<0>(kfl)->at( id0 );
const KeyTimeList::value_type timeB = kfl.get<0>()->at( id1 ); const KeyTimeList::value_type timeB = std::get<0>(kfl)->at( id1 );
// do the actual interpolation in double-precision arithmetics // do the actual interpolation in double-precision arithmetics
// because it is a bit sensitive to rounding errors. // because it is a bit sensitive to rounding errors.
const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) ); const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) );
const float interpValue = static_cast<float>( valueA + ( valueB - valueA ) * factor ); const float interpValue = static_cast<float>( valueA + ( valueB - valueA ) * factor );
result[ kfl.get<2>() ] = interpValue; result[ std::get<2>(kfl) ] = interpValue;
} }
// magic value to convert fbx times to seconds // magic value to convert fbx times to seconds

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Defines.h" #include "Defines.h"
#include <iterator> #include <iterator>
#include <boost/tuple/tuple.hpp> #include <tuple>
namespace Assimp { namespace Assimp {
@ -510,7 +510,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
if( !blackside.empty() ) if( !blackside.empty() )
{ {
// poly edge index, intersection point, edge index in boundary poly // poly edge index, intersection point, edge index in boundary poly
std::vector<boost::tuple<size_t, IfcVector3, size_t> > intersections; std::vector<std::tuple<size_t, IfcVector3, size_t> > intersections;
bool startedInside = PointInPoly(proj * blackside.front(), profile->verts); bool startedInside = PointInPoly(proj * blackside.front(), profile->verts);
bool isCurrentlyInside = startedInside; bool isCurrentlyInside = startedInside;
@ -542,7 +542,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
} }
// now add them to the list of intersections // now add them to the list of intersections
for( size_t b = 0; b < intersected_boundary.size(); ++b ) for( size_t b = 0; b < intersected_boundary.size(); ++b )
intersections.push_back(boost::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first)); intersections.push_back(std::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first));
// and calculate our new inside/outside state // and calculate our new inside/outside state
if( intersected_boundary.size() & 1 ) if( intersected_boundary.size() & 1 )
@ -568,12 +568,12 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
// Filter pairs of out->in->out that lie too close to each other. // Filter pairs of out->in->out that lie too close to each other.
for( size_t a = 0; intersections.size() > 0 && a < intersections.size() - 1; /**/ ) for( size_t a = 0; intersections.size() > 0 && a < intersections.size() - 1; /**/ )
{ {
if( (intersections[a].get<1>() - intersections[(a + 1) % intersections.size()].get<1>()).SquareLength() < 1e-10 ) if( (std::get<1>(intersections[a]) - std::get<1>(intersections[(a + 1) % intersections.size()])).SquareLength() < 1e-10 )
intersections.erase(intersections.begin() + a, intersections.begin() + a + 2); intersections.erase(intersections.begin() + a, intersections.begin() + a + 2);
else else
a++; a++;
} }
if( intersections.size() > 1 && (intersections.back().get<1>() - intersections.front().get<1>()).SquareLength() < 1e-10 ) if( intersections.size() > 1 && (std::get<1>(intersections.back()) - std::get<1>(intersections.front())).SquareLength() < 1e-10 )
{ {
intersections.pop_back(); intersections.erase(intersections.begin()); intersections.pop_back(); intersections.erase(intersections.begin());
} }
@ -619,23 +619,23 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
while( true ) while( true )
{ {
ai_assert(intersections.size() > currentIntersecIdx + 1); ai_assert(intersections.size() > currentIntersecIdx + 1);
boost::tuple<size_t, IfcVector3, size_t> currintsec = intersections[currentIntersecIdx + 0]; std::tuple<size_t, IfcVector3, size_t> currintsec = intersections[currentIntersecIdx + 0];
boost::tuple<size_t, IfcVector3, size_t> nextintsec = intersections[currentIntersecIdx + 1]; std::tuple<size_t, IfcVector3, size_t> nextintsec = intersections[currentIntersecIdx + 1];
intersections.erase(intersections.begin() + currentIntersecIdx, intersections.begin() + currentIntersecIdx + 2); intersections.erase(intersections.begin() + currentIntersecIdx, intersections.begin() + currentIntersecIdx + 2);
// we start with an in->out intersection // we start with an in->out intersection
resultpoly.push_back(currintsec.get<1>()); resultpoly.push_back(std::get<1>(currintsec));
// climb along the polygon to the next intersection, which should be an out->in // climb along the polygon to the next intersection, which should be an out->in
size_t numPolyPoints = (currintsec.get<0>() > nextintsec.get<0>() ? blackside.size() : 0) size_t numPolyPoints = (std::get<0>(currintsec) > std::get<0>(nextintsec) ? blackside.size() : 0)
+ nextintsec.get<0>() - currintsec.get<0>(); + std::get<0>(nextintsec) - std::get<0>(currintsec);
for( size_t a = 1; a <= numPolyPoints; ++a ) for( size_t a = 1; a <= numPolyPoints; ++a )
resultpoly.push_back(blackside[(currintsec.get<0>() + a) % blackside.size()]); resultpoly.push_back(blackside[(std::get<0>(currintsec) + a) % blackside.size()]);
// put the out->in intersection // put the out->in intersection
resultpoly.push_back(nextintsec.get<1>()); resultpoly.push_back(std::get<1>(nextintsec));
// generate segments along the boundary polygon that lie in the poly's plane until we hit another intersection // generate segments along the boundary polygon that lie in the poly's plane until we hit another intersection
IfcVector3 startingPoint = proj * nextintsec.get<1>(); IfcVector3 startingPoint = proj * std::get<1>(nextintsec);
size_t currentBoundaryEdgeIdx = (nextintsec.get<2>() + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size(); size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size();
size_t nextIntsecIdx = SIZE_MAX; size_t nextIntsecIdx = SIZE_MAX;
while( nextIntsecIdx == SIZE_MAX ) while( nextIntsecIdx == SIZE_MAX )
{ {
@ -676,7 +676,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
// to marching along the poly border from that intersection point // to marching along the poly border from that intersection point
for( size_t a = 0; a < intersections.size(); a += 2 ) for( size_t a = 0; a < intersections.size(); a += 2 )
{ {
dirToThatPoint = proj * intersections[a].get<1>() - startingPoint; dirToThatPoint = proj * std::get<1>(intersections[a]) - startingPoint;
tpt = dirToThatPoint * dirAtPolyPlane; tpt = dirToThatPoint * dirAtPolyPlane;
if( tpt > -1e-6 && tpt <= t && (dirToThatPoint - tpt * dirAtPolyPlane).SquareLength() < 1e-10 ) if( tpt > -1e-6 && tpt <= t && (dirToThatPoint - tpt * dirAtPolyPlane).SquareLength() < 1e-10 )
{ {

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <boost/tuple/tuple.hpp> #include <tuple>
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
# include "../contrib/unzip/unzip.h" # include "../contrib/unzip/unzip.h"

View File

@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory> #include <memory>
#include "../include/assimp/scene.h" #include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp" #include "../include/assimp/DefaultLogger.hpp"
#include <boost/format.hpp>
#include "Defines.h" #include "Defines.h"
#include "TinyFormatter.h" #include "TinyFormatter.h"
#include <cctype> #include <cctype>

View File

@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fast_atof.h" #include "fast_atof.h"
#include "Exceptional.h" #include "Exceptional.h"
#include "TinyFormatter.h" #include "TinyFormatter.h"
#include <boost/lexical_cast.hpp>
#include "ByteSwapper.h" #include "ByteSwapper.h"
#include "../include/assimp/DefaultLogger.hpp" #include "../include/assimp/DefaultLogger.hpp"
@ -731,7 +730,7 @@ void XFileParser::ParseDataObjectMaterial( Material* pMaterial)
std::string matName; std::string matName;
readHeadOfDataObject( &matName); readHeadOfDataObject( &matName);
if( matName.empty()) if( matName.empty())
matName = std::string( "material") + boost::lexical_cast<std::string>( mLineNumber); matName = std::string( "material") + std::to_string( mLineNumber );
pMaterial->mName = matName; pMaterial->mName = matName;
pMaterial->mIsReference = false; pMaterial->mIsReference = false;

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AV_ANIMEVALUATOR_H_INCLUDED #ifndef AV_ANIMEVALUATOR_H_INCLUDED
#define AV_ANIMEVALUATOR_H_INCLUDED #define AV_ANIMEVALUATOR_H_INCLUDED
#include <boost/tuple/tuple.hpp> #include <tuple>
namespace AssimpView namespace AssimpView
{ {
@ -80,7 +80,7 @@ protected:
* Useful to quickly find the corresponding frame for slightly increased time stamps * Useful to quickly find the corresponding frame for slightly increased time stamps
*/ */
double mLastTime; double mLastTime;
std::vector<boost::tuple<unsigned int, unsigned int, unsigned int> > mLastPositions; std::vector<std::tuple<unsigned int, unsigned int, unsigned int> > mLastPositions;
/** The array to store the transformations results of the evaluation */ /** The array to store the transformations results of the evaluation */
std::vector<aiMatrix4x4> mTransforms; std::vector<aiMatrix4x4> mTransforms;