mirror of https://github.com/orefkov/simstr.git
1.8.2
Добавлено несколько методов в hashStrMap. Added several methods to hashStrMap.
This commit is contained in:
parent
a779aa7320
commit
86deccbac3
|
|
@ -5,7 +5,7 @@ include(FetchContent)
|
|||
|
||||
project(
|
||||
simstr
|
||||
VERSION 1.8.1
|
||||
VERSION 1.8.2
|
||||
DESCRIPTION "Yet another modern C++ string library"
|
||||
HOMEPAGE_URL "https://github.com/orefkov/simstr"
|
||||
LANGUAGES CXX
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Бенчмарки
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ PROJECT_NAME = "simstr"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.8.1
|
||||
PROJECT_NUMBER = 1.8.2
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewers a
|
||||
|
|
@ -2928,7 +2928,7 @@ MAX_DOT_GRAPH_DEPTH = 0
|
|||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.20) support
|
||||
# this, this feature is disabled by default.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ PROJECT_NAME = "simstr"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.8.1
|
||||
PROJECT_NUMBER = 1.8.2
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewers a
|
||||
|
|
@ -2928,7 +2928,7 @@ MAX_DOT_GRAPH_DEPTH = 0
|
|||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.20) support
|
||||
# this, this feature is disabled by default.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Классы для работы со строками
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
@ -4365,8 +4365,7 @@ public:
|
|||
}
|
||||
|
||||
auto erase(const InStore& key) {
|
||||
auto it = hash_t::find(key);
|
||||
if (it != hash_t::end()) {
|
||||
if (auto it = hash_t::find(key); it != hash_t::end()) {
|
||||
((sstring<K>*)it->first.node)->~sstring();
|
||||
hash_t::erase(it);
|
||||
return 1;
|
||||
|
|
@ -4378,15 +4377,151 @@ public:
|
|||
return erase(toStoreType(key));
|
||||
}
|
||||
|
||||
bool lookup(simple_str<K> txt, T& val) const {
|
||||
auto it = find(txt);
|
||||
if (it != hash_t::end()) {
|
||||
/*!
|
||||
* @ru @brief Поиск и извлечение значения.
|
||||
* @param key - искомый ключ.
|
||||
* @param val - ссылка на приёмник значения.
|
||||
* @details Если ключ существует, присваивает переданной ссылке хранимое значение и возвращает true.
|
||||
* Иначе возвращает false.
|
||||
* @en @brief Finding and retrieving the value.
|
||||
* @param key - the key you are looking for.
|
||||
* @param val - reference to the value receiver.
|
||||
* @details If the key exists, assigns the stored value to the passed reference and returns true.
|
||||
* Otherwise returns false.
|
||||
*/
|
||||
template<typename Dst> requires std::is_assignable_v<T, Dst>
|
||||
bool lookup(simple_str<K> key, Dst& val) const {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
val = it->second;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск и извлечение значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, присваивает переданной ссылке хранимое значение и возвращает true.
|
||||
* Иначе возвращает false.
|
||||
* @en @brief Finding and retrieving the value.
|
||||
* @param key - the key you are looking for.
|
||||
* @param val - reference to the value receiver.
|
||||
* @details If the key exists, assigns the stored value to the passed reference and returns true.
|
||||
* Otherwise returns false.
|
||||
*/
|
||||
template<typename Dst> requires std::is_assignable_v<T, Dst>
|
||||
bool lookup(const InStore& key, Dst& val) const {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
val = it->second;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск и извлечение значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, возвращает std::optional указанного типа с копией значения.
|
||||
* Иначе возвращает std::nullopt.
|
||||
* @en @brief Finding and retrieving the value.
|
||||
* @param key - the key you are looking for.
|
||||
* @details If the key exists, return a std::optional of the specified type with a copy of the value.
|
||||
* Otherwise returns std::nullopt.
|
||||
*/
|
||||
template<typename Dst = T> requires std::is_constructible_v<Dst, T>
|
||||
std::optional<Dst> get(simple_str<K> key) const {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
return it->second;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск и извлечение значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, возвращает std::optional указанного типа с копией значения.
|
||||
* Иначе возвращает std::nullopt.
|
||||
* @en @brief Finding and retrieving the value.
|
||||
* @param s - the key you are looking for.
|
||||
* @details If the key exists, return a std::optional of the specified type with a copy of the value.
|
||||
* Otherwise returns std::nullopt.
|
||||
*/
|
||||
template<typename Dst = T> requires std::is_constructible_v<Dst, T>
|
||||
std::optional<Dst> get(const InStore& key) const {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
return it->second;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск существующего значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, возвращает указатель на хранимое значение.
|
||||
* Иначе возвращает nullptr.
|
||||
* @en @brief Finding an existing value.
|
||||
* @param s - the key you are looking for.
|
||||
* @details If the key exists, returns a pointer to the stored value.
|
||||
* Otherwise returns nullptr.
|
||||
*/
|
||||
T* existed(simple_str<K> key) {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
return std::addressof(it->second);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск существующего значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, возвращает указатель на хранимое значение.
|
||||
* Иначе возвращает nullptr.
|
||||
* @en @brief Finding an existing value.
|
||||
* @param s - the key you are looking for.
|
||||
* @details If the key exists, returns a pointer to the stored value.
|
||||
* Otherwise returns nullptr.
|
||||
*/
|
||||
T* existed(const InStore& key) {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
return std::addressof(it->second);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск существующего значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, возвращает константный указатель на хранимое значение.
|
||||
* Иначе возвращает nullptr.
|
||||
* @en @brief Finding an existing value.
|
||||
* @param s - the key you are looking for.
|
||||
* @details If the key exists, returns a constant pointer to the stored value.
|
||||
* Otherwise returns nullptr.
|
||||
*/
|
||||
const T* existed(simple_str<K> key) const {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
return std::addressof(it->second);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @ru @brief Поиск существующего значения.
|
||||
* @param key - искомый ключ.
|
||||
* @details Если ключ существует, возвращает константный указатель на хранимое значение.
|
||||
* Иначе возвращает nullptr.
|
||||
* @en @brief Finding an existing value.
|
||||
* @param s - the key you are looking for.
|
||||
* @details If the key exists, returns a constant pointer to the stored value.
|
||||
* Otherwise returns nullptr.
|
||||
*/
|
||||
const T* existed(const InStore& key) const {
|
||||
if (auto it = find(key); it != hash_t::end()) {
|
||||
return std::addressof(it->second);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
for (auto& k: *this)
|
||||
((sstring<K>*)k.first.node)->~sstring();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* База для строковых конкатенаций через выражения времени компиляции
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
[](https://github.com/orefkov/simstr/actions/workflows/cmake-multi-platform.yml)
|
||||
|
||||
Version 1.8.1.
|
||||
Version 1.8.2.
|
||||
|
||||
<h2>Speed up your work with strings by 2-10 times!</h2>
|
||||
|
||||
|
|
@ -325,8 +325,8 @@ function(add_simstr)
|
|||
simstr
|
||||
GIT_REPOSITORY https://github.com/orefkov/simstr.git
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_TAG tags/rel1.8.1 # Specify the desired release
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.8.1
|
||||
GIT_TAG tags/rel1.8.2 # Specify the desired release
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.8.2
|
||||
)
|
||||
FetchContent_MakeAvailable(simstr)
|
||||
endfunction()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
[](https://github.com/orefkov/simstr/actions/workflows/cmake-multi-platform.yml)
|
||||
|
||||
Версия 1.8.1.
|
||||
Версия 1.8.2.
|
||||
|
||||
<h2>Ускорь работу со строками в 2-10 раз!</h2>
|
||||
|
||||
|
|
@ -326,8 +326,8 @@ function(add_simstr)
|
|||
simstr
|
||||
GIT_REPOSITORY https://github.com/orefkov/simstr.git
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_TAG tags/rel1.8.1 # Укажите нужный релиз
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.8.1
|
||||
GIT_TAG tags/rel1.8.2 # Укажите нужный релиз
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.8.2
|
||||
)
|
||||
FetchContent_MakeAvailable(simstr)
|
||||
endfunction()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Реализация строковых функций
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Тесты simstr
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Тесты simstr
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.8.1
|
||||
* ver. 1.8.2
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Тесты simstr
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
Loading…
Reference in New Issue