Преглед на файлове

Replaced boost::tuple with std::tuple

mensinda преди 9 години
родител
ревизия
ae99f99b99
променени са 8 файла, в които са добавени 37 реда и са изтрити 40 реда
  1. 3 3
      code/ColladaExporter.cpp
  2. 1 2
      code/ColladaExporter.h
  3. 14 14
      code/FBXConverter.cpp
  4. 15 15
      code/IFCBoolean.cpp
  5. 1 1
      code/IFCLoader.cpp
  6. 0 1
      code/XFileImporter.cpp
  7. 1 2
      code/XFileParser.cpp
  8. 2 2
      tools/assimp_view/AnimEvaluator.h

+ 3 - 3
code/ColladaExporter.cpp

@@ -636,7 +636,7 @@ void ColladaExporter::WriteMaterials()
     aiString name;
     if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS )
       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 ) {
       if( !isalnum_C( *it ) ) {
         *it = '_';
@@ -812,7 +812,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
     {
         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);
         }
     }
@@ -821,7 +821,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
     for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++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

+ 1 - 2
code/ColladaExporter.h

@@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <sstream>
 #include <vector>
 #include <map>
-#include <boost/lexical_cast.hpp>
 
 struct aiScene;
 struct aiNode;
@@ -123,7 +122,7 @@ protected:
     void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); }
 
     /// 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:
     /// Stringstream to write all output into

+ 14 - 14
code/FBXConverter.cpp

@@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "StringComparison.h"
 
 #include "../include/assimp/scene.h"
-#include <boost/tuple/tuple.hpp>
+#include <tuple>
 #include <memory>
 
 #include <iterator>
@@ -338,7 +338,7 @@ private:
         bool reverse_order = false );
 
     // 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;
 
 
@@ -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 :-)
@@ -2984,7 +2984,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
 
     size_t estimate = 0;
     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 );
@@ -2999,8 +2999,8 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
         for ( size_t i = 0; i < count; ++i ) {
             const KeyFrameList& kfl = inputs[ i ];
 
-            if ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) < min_tick ) {
-                min_tick = kfl.get<0>()->at( next_pos[ i ] );
+            if ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) < min_tick ) {
+                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 ];
 
 
-            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 ];
             }
         }
@@ -3042,8 +3042,8 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
         for ( size_t i = 0; i < count; ++i ) {
             const KeyFrameList& kfl = inputs[ i ];
 
-            const size_t ksize = kfl.get<0>()->size();
-            if ( ksize > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == time ) {
+            const size_t ksize = std::get<0>(kfl)->size();
+            if ( ksize > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == time ) {
                 ++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 ];
 
             // use lerp for interpolation
-            const KeyValueList::value_type valueA = kfl.get<1>()->at( id0 );
-            const KeyValueList::value_type valueB = kfl.get<1>()->at( id1 );
+            const KeyValueList::value_type valueA = std::get<1>(kfl)->at( id0 );
+            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 timeB = kfl.get<0>()->at( id1 );
+            const KeyTimeList::value_type timeA = std::get<0>(kfl)->at( id0 );
+            const KeyTimeList::value_type timeB = std::get<0>(kfl)->at( id1 );
 
             // do the actual interpolation in double-precision arithmetics
             // because it is a bit sensitive to rounding errors.
             const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) );
             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

+ 15 - 15
code/IFCBoolean.cpp

@@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "Defines.h"
 
 #include <iterator>
-#include <boost/tuple/tuple.hpp>
+#include <tuple>
 
 
 namespace Assimp {
@@ -510,7 +510,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
         if( !blackside.empty() )
         {
             // 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 isCurrentlyInside = startedInside;
 
@@ -542,7 +542,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
                 }
                 // now add them to the list of intersections
                 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
                 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.
                 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);
                     else
                         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());
                 }
@@ -619,23 +619,23 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
                 while( true )
                 {
                     ai_assert(intersections.size() > currentIntersecIdx + 1);
-                    boost::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> currintsec = intersections[currentIntersecIdx + 0];
+                    std::tuple<size_t, IfcVector3, size_t> nextintsec = intersections[currentIntersecIdx + 1];
                     intersections.erase(intersections.begin() + currentIntersecIdx, intersections.begin() + currentIntersecIdx + 2);
 
                     // 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
-                    size_t numPolyPoints = (currintsec.get<0>() > nextintsec.get<0>() ? blackside.size() : 0)
-                        + nextintsec.get<0>() - currintsec.get<0>();
+                    size_t numPolyPoints = (std::get<0>(currintsec) > std::get<0>(nextintsec) ? blackside.size() : 0)
+                        + std::get<0>(nextintsec) - std::get<0>(currintsec);
                     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
-                    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
-                    IfcVector3 startingPoint = proj * nextintsec.get<1>();
-                    size_t currentBoundaryEdgeIdx = (nextintsec.get<2>() + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size();
+                    IfcVector3 startingPoint = proj * std::get<1>(nextintsec);
+                    size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size();
                     size_t 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
                         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;
                             if( tpt > -1e-6 && tpt <= t && (dirToThatPoint - tpt * dirAtPolyPlane).SquareLength() < 1e-10 )
                             {

+ 1 - 1
code/IFCLoader.cpp

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

+ 0 - 1
code/XFileImporter.cpp

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

+ 1 - 2
code/XFileParser.cpp

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

+ 2 - 2
tools/assimp_view/AnimEvaluator.h

@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef AV_ANIMEVALUATOR_H_INCLUDED
 #define AV_ANIMEVALUATOR_H_INCLUDED
 
-#include <boost/tuple/tuple.hpp>
+#include <tuple>
 
 namespace AssimpView
 {
@@ -80,7 +80,7 @@ protected:
      * Useful to quickly find the corresponding frame for slightly increased time stamps
      */
     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 */
     std::vector<aiMatrix4x4> mTransforms;