From 0288e8de9d3444f083a4426fa9b05fc49a54ab42 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sat, 23 Mar 2024 11:48:23 +0100 Subject: [PATCH] refactor: clean up --- lib_vector_search/src/word_list.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib_vector_search/src/word_list.cpp b/lib_vector_search/src/word_list.cpp index e1baf7c..c4e4294 100644 --- a/lib_vector_search/src/word_list.cpp +++ b/lib_vector_search/src/word_list.cpp @@ -1,7 +1,9 @@ #include "word_list.h" #include +#include #include +#include #include WordList &WordList::multiply(size_t factor) { @@ -26,12 +28,12 @@ WordList &WordList::shuffle() { } WordList WordList::oneCap() { - const static std::string charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + const static std::string charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; WordList word_list; - word_list.reserve(charset_.length()); + word_list.reserve(charset.length()); - for (auto char_1 : charset_) { + for (const auto char_1 : charset) { word_list.emplace_back(std::initializer_list({char_1})); } @@ -39,15 +41,15 @@ WordList WordList::oneCap() { }; WordList WordList::fourCaps() { - const static std::string charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + const static std::string charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; WordList word_list; - word_list.reserve(std::pow(charset_.length(), 4)); + word_list.reserve(std::pow(charset.length(), 4)); - for (auto char_1 : charset_) { - for (auto char_2 : charset_) { - for (auto char_3 : charset_) { - for (auto char_4 : charset_) { + for (const auto char_1 : charset) { + for (const auto char_2 : charset) { + for (const auto char_3 : charset) { + for (const auto char_4 : charset) { word_list.emplace_back( std::initializer_list({char_1, char_2, char_3, char_4})); }