trailing types instead of return types

This commit is contained in:
Phuntsok Drak-pa 2019-04-01 16:55:02 +02:00
parent 8a215f4a74
commit 801e74d752
6 changed files with 29 additions and 30 deletions

View File

@ -7,9 +7,9 @@
#include <string>
#include <utility>
[[nodiscard]] std::pair<cv::Mat, cv::Mat> init_image(
std::string const&) noexcept;
[[nodiscard]] auto init_image(std::string const&) noexcept
-> std::pair<cv::Mat, cv::Mat>;
[[nodiscard]] double euclidian_distance(cv::Mat const&, cv::Mat const&);
[[nodiscard]] auto euclidian_distance(cv::Mat const&, cv::Mat const&) -> double;
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_COMMON_HH_ */

View File

@ -4,8 +4,7 @@
#include <filesystem>
#include <tuple>
[[nodiscard]] std::
tuple<std::filesystem::path, std::filesystem::path, int, int, bool>
parse_args(int, char**);
[[nodiscard]] auto parse_args(int, char**)
-> std::tuple<std::filesystem::path, std::filesystem::path, int, int, bool>;
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_PARSEARGS_HH_ */

View File

@ -3,8 +3,8 @@
#include <cmath>
#include <cstdlib>
[[nodiscard]] std::pair<cv::Mat, cv::Mat> init_image(
std::string const& t_input_file) noexcept
[[nodiscard]] auto init_image(std::string const& t_input_file) noexcept
-> std::pair<cv::Mat, cv::Mat>
{
cv::Mat input_image = cv::imread(t_input_file, cv::IMREAD_COLOR);
if (!input_image.data) {
@ -19,8 +19,8 @@
return std::make_pair(std::move(input_image), process_image);
}
[[nodiscard]] double euclidian_distance(cv::Mat const& t_img1,
cv::Mat const& t_img2)
[[nodiscard]] auto euclidian_distance(cv::Mat const& t_img1,
cv::Mat const& t_img2) -> double
{
double euclidian = 0.0;
for (auto itr1 = t_img1.begin<uchar>(), itr2 = t_img2.begin<uchar>();

View File

@ -31,7 +31,7 @@ void adjustSize(cv::Mat const& t_process_img, cv::Point& t_top_left, int size)
}
}
[[nodiscard]] cv::Scalar randomColor()
[[nodiscard]] auto randomColor() -> cv::Scalar
{
static std::uniform_int_distribution<> dis(0, 255);
return cv::Scalar(rand() % 255, rand() % 255, rand() % 255);
@ -60,12 +60,12 @@ void threadedGetColor(cv::Mat const& t_reference, ColorSet& t_colors, int t_h)
}
}
[[nodiscard]] ColorSet getColorSet(cv::Mat const& t_reference)
[[nodiscard]] auto getColorSet(cv::Mat const& t_reference) -> ColorSet
{
ColorSet res{};
for (int h = 0; h < t_reference.size().height; h += thread_nbr) {
std::vector<std::thread> thread_list{};
for (int i = 0; i < thread_nbr; ++i) {
for (auto i = 0u; i < thread_nbr; ++i) {
thread_list.push_back(std::thread(methods_private::threadedGetColor,
std::ref(t_reference), std::ref(res),
h + i));

View File

@ -21,8 +21,8 @@ void processFilenames(po::variables_map const& vm,
}
}
[[nodiscard]] std::tuple<path, path, int, int, bool> parse_args(int t_ac,
char** t_av)
[[nodiscard]] auto parse_args(int t_ac, char** t_av)
-> std::tuple<path, path, int, int, bool>
{
po::options_description desc("Allowed options");
desc.add_options()("help,h", "Display this help message")(