Replace make_pair with {}

release/4.3a0
Frank Dellaert 2023-02-04 09:08:34 -08:00
parent 0710091887
commit 6c0cab25a3
15 changed files with 26 additions and 26 deletions

View File

@ -69,7 +69,7 @@ class WeightedSampler {
static const double kexp1 = std::exp(1.0); static const double kexp1 = std::exp(1.0);
for (auto it = weights.begin(); it != weights.begin() + numSamples; ++it) { for (auto it = weights.begin(); it != weights.begin() + numSamples; ++it) {
const double k_i = kexp1 / *it; const double k_i = kexp1 / *it;
reservoir.push(std::make_pair(k_i, it - weights.begin() + 1)); reservoir.push({k_i, it - weights.begin() + 1});
} }
// Step 4: Repeat Steps 510 until the population is exhausted // Step 4: Repeat Steps 510 until the population is exhausted
@ -110,7 +110,7 @@ class WeightedSampler {
// Step 8: The item in reservoir with the minimum key is replaced by // Step 8: The item in reservoir with the minimum key is replaced by
// item v_i // item v_i
reservoir.pop(); reservoir.pop();
reservoir.push(std::make_pair(k_i, it - weights.begin() + 1)); reservoir.push({k_i, it - weights.begin() + 1});
} }
} }

View File

@ -424,10 +424,10 @@ namespace gtsam {
template <typename L, typename T1, typename T2> template <typename L, typename T1, typename T2>
std::pair<DecisionTree<L, T1>, DecisionTree<L, T2> > unzip( std::pair<DecisionTree<L, T1>, DecisionTree<L, T2> > unzip(
const DecisionTree<L, std::pair<T1, T2> >& input) { const DecisionTree<L, std::pair<T1, T2> >& input) {
return std::make_pair( return {
DecisionTree<L, T1>(input, [](std::pair<T1, T2> i) { return i.first; }), DecisionTree<L, T1>(input, [](std::pair<T1, T2> i) { return i.first; }),
DecisionTree<L, T2>(input, DecisionTree<L, T2>(input, [](std::pair<T1, T2> i) { return i.second; })
[](std::pair<T1, T2> i) { return i.second; })); };
} }
} // namespace gtsam } // namespace gtsam

View File

@ -140,8 +140,7 @@ namespace gtsam {
orderedKeys, product); orderedKeys, product);
gttoc(lookup); gttoc(lookup);
return std::make_pair( return {std::dynamic_pointer_cast<DiscreteConditional>(lookup), max};
std::dynamic_pointer_cast<DiscreteConditional>(lookup), max);
} }
/* ************************************************************************ */ /* ************************************************************************ */
@ -223,7 +222,7 @@ namespace gtsam {
std::make_shared<DiscreteConditional>(product, *sum, orderedKeys); std::make_shared<DiscreteConditional>(product, *sum, orderedKeys);
gttoc(divide); gttoc(divide);
return std::make_pair(conditional, sum); return {conditional, sum};
} }
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -223,7 +223,7 @@ public:
* @return a pair of [start, end] indices into the tangent space vector * @return a pair of [start, end] indices into the tangent space vector
*/ */
inline static std::pair<size_t, size_t> translationInterval() { inline static std::pair<size_t, size_t> translationInterval() {
return std::make_pair(3, 5); return {3, 5};
} }
/// @} /// @}

View File

@ -309,14 +309,14 @@ public:
* exponential map parameterization * exponential map parameterization
* @return a pair of [start, end] indices into the tangent space vector * @return a pair of [start, end] indices into the tangent space vector
*/ */
inline static std::pair<size_t, size_t> translationInterval() { return std::make_pair(0, 1); } inline static std::pair<size_t, size_t> translationInterval() { return {0, 1}; }
/** /**
* Return the start and end indices (inclusive) of the rotation component of the * Return the start and end indices (inclusive) of the rotation component of the
* exponential map parameterization * exponential map parameterization
* @return a pair of [start, end] indices into the tangent space vector * @return a pair of [start, end] indices into the tangent space vector
*/ */
static std::pair<size_t, size_t> rotationInterval() { return std::make_pair(2, 2); } static std::pair<size_t, size_t> rotationInterval() { return {2, 2}; }
/// Output stream operator /// Output stream operator
GTSAM_EXPORT GTSAM_EXPORT

View File

@ -364,7 +364,7 @@ public:
* @return a pair of [start, end] indices into the tangent space vector * @return a pair of [start, end] indices into the tangent space vector
*/ */
inline static std::pair<size_t, size_t> translationInterval() { inline static std::pair<size_t, size_t> translationInterval() {
return std::make_pair(3, 5); return {3, 5};
} }
/** /**
@ -373,7 +373,7 @@ public:
* @return a pair of [start, end] indices into the tangent space vector * @return a pair of [start, end] indices into the tangent space vector
*/ */
static std::pair<size_t, size_t> rotationInterval() { static std::pair<size_t, size_t> rotationInterval() {
return std::make_pair(0, 2); return {0, 2};
} }
/** /**

View File

@ -176,7 +176,7 @@ TEST(Point3, mean) {
TEST(Point3, mean_pair) { TEST(Point3, mean_pair) {
Point3 a_mean(2, 2, 2), b_mean(-1, 1, 0); Point3 a_mean(2, 2, 2), b_mean(-1, 1, 0);
Point3Pair expected = std::make_pair(a_mean, b_mean); Point3Pair expected = {a_mean, b_mean};
Point3 a1(0, 0, 0), a2(1, 2, 3), a3(5, 4, 3); Point3 a1(0, 0, 0), a2(1, 2, 3), a3(5, 4, 3);
Point3 b1(-1, 0, 0), b2(-2, 4, 0), b3(0, -1, 0); Point3 b1(-1, 0, 0), b2(-2, 4, 0), b3(0, -1, 0);
std::vector<Point3Pair> point_pairs{{a1, b1}, {a2, b2}, {a3, b3}}; std::vector<Point3Pair> point_pairs{{a1, b1}, {a2, b2}, {a3, b3}};

View File

@ -137,7 +137,7 @@ std::pair<NonlinearFactorGraph, Values> triangulationGraph(
graph.emplace_shared<TriangulationFactor<Camera> > // graph.emplace_shared<TriangulationFactor<Camera> > //
(camera_i, measurements[i], model, landmarkKey); (camera_i, measurements[i], model, landmarkKey);
} }
return std::make_pair(graph, values); return {graph, values};
} }
/** /**
@ -165,7 +165,7 @@ std::pair<NonlinearFactorGraph, Values> triangulationGraph(
graph.emplace_shared<TriangulationFactor<CAMERA> > // graph.emplace_shared<TriangulationFactor<CAMERA> > //
(camera_i, measurements[i], model? model : unit, landmarkKey); (camera_i, measurements[i], model? model : unit, landmarkKey);
} }
return std::make_pair(graph, values); return {graph, values};
} }
/** /**

View File

@ -273,7 +273,7 @@ EliminatableClusterTree<BAYESTREE, GRAPH>::eliminate(const Eliminate& function)
} }
// Return result // Return result
return std::make_pair(result, remaining); return {result, remaining};
} }
} // namespace gtsam } // namespace gtsam

View File

@ -473,7 +473,7 @@ std::pair<GaussianFactorGraph, GaussianFactorGraph> splitFactorGraph(
remaining.remove(e.index); remaining.remove(e.index);
} }
return std::make_pair(subgraphFactors, remaining); return {subgraphFactors, remaining};
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -229,7 +229,7 @@ typename Expression<T>::KeysAndDims Expression<T>::keysAndDims() const {
std::map<Key, int> map; std::map<Key, int> map;
dims(map); dims(map);
size_t n = map.size(); size_t n = map.size();
KeysAndDims pair = std::make_pair(KeyVector(n), FastVector<int>(n)); KeysAndDims pair = {KeyVector(n), FastVector<int>(n)};
// Copy map into pair of vectors // Copy map into pair of vectors
auto key_it = pair.first.begin(); auto key_it = pair.first.begin();
auto dim_it = pair.second.begin(); auto dim_it = pair.second.begin();

View File

@ -116,7 +116,7 @@ MFAS::MFAS(const TranslationEdges& relativeTranslations,
// Iterate over edges, obtain weights by projecting // Iterate over edges, obtain weights by projecting
// their relativeTranslations along the projection direction // their relativeTranslations along the projection direction
for (const auto& measurement : relativeTranslations) { for (const auto& measurement : relativeTranslations) {
edgeWeights_[std::make_pair(measurement.key1(), measurement.key2())] = edgeWeights_[{measurement.key1(), measurement.key2()}] =
measurement.measured().dot(projectionDirection); measurement.measured().dot(projectionDirection);
} }
} }

View File

@ -755,7 +755,7 @@ std::pair<double, Vector> ShonanAveraging<d>::computeMinEigenVector(
const Values &values) const { const Values &values) const {
Vector minEigenVector; Vector minEigenVector;
double minEigenValue = computeMinEigenValue(values, &minEigenVector); double minEigenValue = computeMinEigenValue(values, &minEigenVector);
return std::make_pair(minEigenValue, minEigenVector); return {minEigenValue, minEigenVector};
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -908,7 +908,7 @@ std::pair<Values, double> ShonanAveraging<d>::run(const Values &initialEstimate,
"When using robust norm, Shonan only tests a single rank. Set pMin = pMax"); "When using robust norm, Shonan only tests a single rank. Set pMin = pMax");
} }
const Values SO3Values = roundSolution(Qstar); const Values SO3Values = roundSolution(Qstar);
return std::make_pair(SO3Values, 0); return {SO3Values, 0};
} else { } else {
// Check certificate of global optimality // Check certificate of global optimality
Vector minEigenVector; Vector minEigenVector;
@ -916,7 +916,7 @@ std::pair<Values, double> ShonanAveraging<d>::run(const Values &initialEstimate,
if (minEigenValue > parameters_.optimalityThreshold) { if (minEigenValue > parameters_.optimalityThreshold) {
// If at global optimum, round and return solution // If at global optimum, round and return solution
const Values SO3Values = roundSolution(Qstar); const Values SO3Values = roundSolution(Qstar);
return std::make_pair(SO3Values, minEigenValue); return {SO3Values, minEigenValue};
} }
// Not at global optimimum yet, so check whether we will go to next level // Not at global optimimum yet, so check whether we will go to next level

View File

@ -148,7 +148,7 @@ public:
std::pair<Matrix, Vector> jacobian() const override { std::pair<Matrix, Vector> jacobian() const override {
throw std::runtime_error( throw std::runtime_error(
"RegularImplicitSchurFactor::jacobian non implemented"); "RegularImplicitSchurFactor::jacobian non implemented");
return std::make_pair(Matrix(), Vector()); return {Matrix(), Vector()};
} }
/// *Compute* full augmented information matrix /// *Compute* full augmented information matrix

View File

@ -61,9 +61,10 @@ namespace gtsam
std::set_difference(allKeys.begin(), allKeys.end(), frontals.begin(), frontals.end(), orderedKeys.begin() + nFrontals); std::set_difference(allKeys.begin(), allKeys.end(), frontals.begin(), frontals.end(), orderedKeys.begin() + nFrontals);
// Return resulting conditional and factor // Return resulting conditional and factor
return std::make_pair( return {
SymbolicConditional::FromKeysShared(orderedKeys, nFrontals), SymbolicConditional::FromKeysShared(orderedKeys, nFrontals),
SymbolicFactor::FromIteratorsShared(orderedKeys.begin() + nFrontals, orderedKeys.end())); SymbolicFactor::FromIteratorsShared(orderedKeys.begin() + nFrontals, orderedKeys.end())
};
} }
} }
} }