Fix compilation warnings for unused variables.

This commit is contained in:
Ryan Curtin
2024-02-09 17:53:18 -05:00
parent 5bb9fac6cf
commit bd0effce10
2 changed files with 20 additions and 14 deletions
@@ -48,7 +48,7 @@ class QueryFront
typename MatType,
typename ObjectivesVecType,
typename IndicesType>
bool GenerationalStepTaken(OptimizerType& opt,
bool GenerationalStepTaken(OptimizerType& /* opt */,
FunctionType& /* function */,
const MatType& /* coordinates */,
const ObjectivesVecType& objectives,
@@ -9,28 +9,34 @@
* the 3-clause BSD license along with ensmallen. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef NOT_EMPTY_TRANSFORMATION
#define NOT_EMPTY_TRANSFORMATION
#ifndef ENSMALLEN_CMAES_NOT_EMPTY_TRANSFORMATION
#define ENSMALLEN_CMAES_NOT_EMPTY_TRANSFORMATION
/*
This partial specialization is used to throw an exception when the
TransformationPolicyType is EmptyTransformation and call a
constructor with parameters 'lowerBound' and 'upperBound' otherwise.
This shall be removed when the deprecated constructor is removed in
the next major version of ensmallen.
/**
* This partial specialization is used to throw an exception when the
* TransformationPolicyType is EmptyTransformation and call a constructor with
* parameters 'lowerBound' and 'upperBound' otherwise. This shall be removed
* when the deprecated constructor is removed in the next major version of
* ensmallen.
*/
template<typename T1, typename T2>
struct NotEmptyTransformation : std::true_type {
void Assign(T1& obj, double lowerBound, double upperBound) {
struct NotEmptyTransformation : std::true_type
{
void Assign(T1& obj, double lowerBound, double upperBound)
{
obj = T1(lowerBound, upperBound);
}
};
template<template<typename...> class T, typename... A, typename... B>
struct NotEmptyTransformation<T<A...>, T<B...>> : std::false_type {
void Assign(T<A...>& obj, double lowerBound, double upperBound) {
struct NotEmptyTransformation<T<A...>, T<B...>> : std::false_type
{
void Assign(T<A...>& /* obj */,
double /* lowerBound */,
double /* upperBound */)
{
throw std::logic_error("TransformationPolicyType is EmptyTransformation");
}
};
#endif
#endif