Skip to content

Commit

Permalink
TreeTraits
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Nov 1, 2024
1 parent d56de47 commit 421d4b4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions include/momo/TreeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ template<typename TKey,
typename TLessFunc = std::less<TKey>,
bool tMultiKey = false,
typename TTreeNode = TreeNodeDefault>
class TreeTraitsStd : private TLessFunc
class TreeTraitsStd
{
public:
typedef TKey Key;
Expand All @@ -140,7 +140,7 @@ class TreeTraitsStd : private TLessFunc

public:
explicit TreeTraitsStd(const LessFunc& lessFunc = LessFunc())
: LessFunc(lessFunc)
: mLessFunc(lessFunc)
{
}

Expand All @@ -152,13 +152,16 @@ class TreeTraitsStd : private TLessFunc
template<typename KeyArg1, typename KeyArg2>
bool IsLess(const KeyArg1& key1, const KeyArg2& key2) const
{
return LessFunc::operator()(key1, key2);
return mLessFunc(key1, key2);
}

const LessFunc& GetLessFunc() const noexcept
{
return *this;
return mLessFunc;
}

private:
/*[[no_unique_address]]*/ LessFunc mLessFunc;
};

} // namespace momo
Expand Down

0 comments on commit 421d4b4

Please sign in to comment.