Use std::unordered_set

This commit is contained in:
Tact Yoshida 2020-01-22 17:32:54 +09:00
parent 1c2b20d028
commit 47eaf794ad

View file

@ -12,8 +12,7 @@
#include "tcg/tcg_macros.h" #include "tcg/tcg_macros.h"
#include "tcg/tcg_point_ops.h" #include "tcg/tcg_point_ops.h"
// boost includes #include <unordered_set>
#include <boost/unordered_set.hpp>
#include <unordered_map> #include <unordered_map>
using namespace tcg::bgl; using namespace tcg::bgl;
@ -494,13 +493,13 @@ namespace locals_ { // Need to use a named namespace due to
// a known gcc 4.2 bug with compiler-generated // a known gcc 4.2 bug with compiler-generated
struct VertexesRecorder // copy constructors. struct VertexesRecorder // copy constructors.
{ {
boost::unordered_set<int> &m_examinedVertexes; std::unordered_set<int> &m_examinedVertexes;
public: public:
typedef boost::on_examine_vertex event_filter; typedef boost::on_examine_vertex event_filter;
public: public:
VertexesRecorder(boost::unordered_set<int> &examinedVertexes) VertexesRecorder(std::unordered_set<int> &examinedVertexes)
: m_examinedVertexes(examinedVertexes) {} : m_examinedVertexes(examinedVertexes) {}
void operator()(int v, const TTextureMesh &) { m_examinedVertexes.insert(v); } void operator()(int v, const TTextureMesh &) { m_examinedVertexes.insert(v); }
@ -511,7 +510,7 @@ namespace { //
void splitUnconnectedMesh(TMeshImage &mi, int meshIdx) { void splitUnconnectedMesh(TMeshImage &mi, int meshIdx) {
struct locals { struct locals {
static void buildConnectedComponent(const TTextureMesh &mesh, static void buildConnectedComponent(const TTextureMesh &mesh,
boost::unordered_set<int> &vertexes) { std::unordered_set<int> &vertexes) {
// Prepare BFS algorithm // Prepare BFS algorithm
std::unique_ptr<UCHAR[]> colorMapP(new UCHAR[mesh.vertices().nodesCount()]()); std::unique_ptr<UCHAR[]> colorMapP(new UCHAR[mesh.vertices().nodesCount()]());
@ -528,7 +527,7 @@ void splitUnconnectedMesh(TMeshImage &mi, int meshIdx) {
// Retrieve the list of vertexes in the first connected component // Retrieve the list of vertexes in the first connected component
TTextureMesh &origMesh = *mi.meshes()[meshIdx]; TTextureMesh &origMesh = *mi.meshes()[meshIdx];
boost::unordered_set<int> firstComponent; std::unordered_set<int> firstComponent;
locals::buildConnectedComponent(origMesh, firstComponent); locals::buildConnectedComponent(origMesh, firstComponent);
if (firstComponent.size() == origMesh.verticesCount()) return; if (firstComponent.size() == origMesh.verticesCount()) return;