864 tempLat,
865 tempLon);
866
867 return geoops::RoverPose(stCurrentVIOPosition, dCurrentHeading);868}
869
870/******************************************************************************
522 LOG_ERROR(logging::g_qSharedLogger, "Attempted to pop a waypoint from the WaypointHandler but it is empty!");
523
524 // Return an empty waypoint.
525 return geoops::Waypoint(geoops::GPSCoordinate(), geoops::WaypointType::eUNKNOWN);526 }
527}
528
The use of constructor on return is considered redundant as the type has already been provided by the return type, and writing the constructor again is of no meaningful value to the program.
Instead of using a constructor on return, you should use a braced initializer list which is more succinct and avoids having to change constructor if the return type is changed but the constructible parameters are still valid.
#include <iostream>
#include <vector>
std::vector<int> getVector() {
return std::vector<int>(1, 2, 3);
}
int main() {
auto v = getVector();
for (auto i : v) {
std::cout << i << " ";
}
}
#include <iostream>
#include <vector>
#include <tuple>
std::vector<int> getVector() {
return {1, 2, 3};
}
// works without having to change the body
std::tuple<int, int, int> getTuple() {
return {1, 2, 3};
}
int main() {
auto v = getVector();
for (auto i : v) {
std::cout << i << " ";
}
}