8000 Fix clang compiler warnings by ahojnnes · Pull Request #1387 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix clang compiler warnings #1387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/FLANN/algorithms/kdtree_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <cstring>
#include <stdarg.h>
#include <cmath>
#include <random>

#include "FLANN/general.h"
#include "FLANN/algorithms/nn_index.h"
Expand Down Expand Up @@ -261,11 +262,13 @@ class KDTreeIndex : public NNIndex<Distance>
mean_ = new DistanceType[veclen_];
var_ = new DistanceType[veclen_];

std::default_random_engine generator;

tree_roots_.resize(trees_);
/* Construct the randomized trees. */
for (int i = 0; i < trees_; i++) {
/* Randomize the order of vectors to allow for unbiased sampling. */
std::random_shuffle(ind.begin(), ind.end());
std::shuffle(ind.begin(), ind.end(), generator);
tree_roots_[i] = divideTree(&ind[0], int(size_) );
}
delete[] mean_;
Expand Down
3 changes: 2 additions & 1 deletion lib/FLANN/util/lsh_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <random>
// TODO as soon as we use C++0x, use the code in USE_UNORDERED_MAP
#if USE_UNORDERED_MAP
#include <unordered_map>
Expand Down Expand Up @@ -364,7 +365,7 @@ inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int
// A bit brutal but fast to code
std::vector<size_t> indices(feature_size * CHAR_BIT);
for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = i;
std::random_shuffle(indices.begin(), indices.end());
std::shuffle(indices.begin(), indices.end(), std::default_random_engine());

// Generate a random set of order of subsignature_size_ bits
for (unsigned int i = 0; i < key_size_; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions lib/FLANN/util/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <random>

#include "FLANN/general.h"

Expand Down Expand Up @@ -110,14 +111,13 @@ class UniqueRandom
*/
void init(int n)
{
static RandomGenerator generator;
// create and initialize an array of size n
vals_.resize(n);
size_ = n;
for (int i = 0; i < size_; ++i) vals_[i] = i;

// shuffle the elements in the array
std::random_shuffle(vals_.begin(), vals_.end(), generator);
std::shuffle(vals_.begin(), vals_.end(), std::default_random_engine());

counter_ = 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/mvs/workspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Workspace {
};

Workspace(const Options& options);
virtual ~Workspace() = default;

// Do nothing when we use a cache. Data is loaded as needed.
virtual void Load(const std::vector<std::string>& image_names);
Expand Down
0