summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-11-08 20:58:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2020-11-08 20:58:56 +0000
commita13ac3bf53f883112bddc04a18ce6e916f5c4765 (patch)
tree4a9651dd452e75ed1047c93ab4b3a5183e2b8948
parentNo need to generate sequence GetChildRef (diff)
downloadslicer-a13ac3bf53f883112bddc04a18ce6e916f5c4765.tar.bz2
slicer-a13ac3bf53f883112bddc04a18ce6e916f5c4765.tar.xz
slicer-a13ac3bf53f883112bddc04a18ce6e916f5c4765.zip
Untemplate hooks equal range and related bits
-rw-r--r--slicer/slicer/hookMap.h39
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h4
2 files changed, 17 insertions, 26 deletions
diff --git a/slicer/slicer/hookMap.h b/slicer/slicer/hookMap.h
index 58fe014..a0763ac 100644
--- a/slicer/slicer/hookMap.h
+++ b/slicer/slicer/hookMap.h
@@ -13,11 +13,11 @@ namespace Slicer {
public:
using HookPtr = const typename ModelPartForComplex<T>::HookBase *;
- template<typename K> class eq;
+ class eq;
- template<typename K> class iter : public std::iterator<std::bidirectional_iterator_tag, HookPtr> {
+ class iter : public std::iterator<std::bidirectional_iterator_tag, HookPtr> {
public:
- [[nodiscard]] constexpr inline iter(const eq<K> * const r, const HookPtr * c) : range(r), cur(c)
+ [[nodiscard]] constexpr inline iter(const eq * const r, const HookPtr * c) : range(r), cur(c)
{
moveMatch();
}
@@ -73,50 +73,39 @@ namespace Slicer {
}
}
- const eq<K> * const range;
+ const eq * const range;
const HookPtr * cur;
};
- template<typename K> class eq {
+ class eq {
public:
- [[nodiscard]] constexpr inline iter<K>
+ [[nodiscard]] constexpr inline iter
begin() const
{
return {this, b};
}
- [[nodiscard]] constexpr inline iter<K>
+ [[nodiscard]] constexpr inline iter
end() const
{
return {this, e};
}
- K key;
+ std::string_view key;
std::string_view HookCommon::*name;
const HookPtr *b, *e;
};
- template<typename K>
- [[nodiscard]] constexpr inline eq<K>
- equal_range(K && k) const
- {
- return {std::forward<K>(k), &HookCommon::name, _begin, _end};
- }
-
- template<typename K>
- [[nodiscard]] constexpr inline eq<K>
- equal_range_lower(K && k) const
+ [[nodiscard]] constexpr inline eq
+ equal_range(std::string_view k) const
{
- return {std::forward<K>(k), &HookCommon::nameLower, _begin, _end};
+ return {k, &HookCommon::name, _begin, _end};
}
- template<typename K>
- [[nodiscard]] inline auto
- equal_range_nocase(const K & k) const
+ [[nodiscard]] constexpr inline eq
+ equal_range_lower(std::string_view k) const
{
- std::string i {k};
- to_lower(i);
- return equal_range_lower(std::move(i));
+ return {k, &HookCommon::nameLower, _begin, _end};
}
[[nodiscard]] constexpr inline auto
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 9048cf2..a008e02 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -342,7 +342,9 @@ namespace Slicer {
return GetChildRefFromRange(hooks().equal_range(name), flt);
}
else {
- return GetChildRefFromRange(hooks().equal_range_nocase(name), flt);
+ std::string i {name};
+ to_lower(i);
+ return GetChildRefFromRange(hooks().equal_range_lower(i), flt);
}
}