added regex highlights

This commit is contained in:
fourtf
2018-05-06 12:52:47 +02:00
parent ba4173822e
commit b95388107f
24 changed files with 388 additions and 139 deletions
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <memory>
namespace chatterino {
namespace util {
template <typename T>
struct SharedPtrElementLess {
bool operator()(const std::shared_ptr<T> &a, const std::shared_ptr<T> &b) const
{
return a->operator<(*b);
}
};
} // namespace util
} // namespace chatterino
+7 -5
View File
@@ -103,17 +103,19 @@ public:
}
};
template <typename TVectorItem>
template <typename TVectorItem, typename Compare>
class SortedSignalVector : public BaseSignalVector<TVectorItem>
{
public:
virtual int insertItem(const TVectorItem &item, int index = -1, void *caller = 0) override
virtual int insertItem(const TVectorItem &item, int proposedIndex = -1,
void *caller = 0) override
{
util::assertInGuiThread();
int index = this->vector.insert(
std::lower_bound(this->vector.begin(), this->vector.end(), item), item) -
this->vector.begin();
int index =
this->vector.insert(
std::lower_bound(this->vector.begin(), this->vector.end(), item, Compare{}), item) -
this->vector.begin();
typename ReadOnlySignalVector<TVectorItem>::ItemArgs args{item, index, caller};
this->itemInserted.invoke(args);
this->invokeDelayedItemsChanged();