diff options
| author | Maxime Coste <mawww@kakoune.org> | 2025-07-08 11:43:17 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-07-08 12:07:33 +1000 |
| commit | ce1d512a0c1922ab5f43f28e7bae573508c98601 (patch) | |
| tree | 7af8effd6b00c304cda1c87f657a0014fcdae2ae /src/highlighter.hh | |
| parent | fea08fc18d268ace4f843ec2b57cc33e36562098 (diff) | |
Replace std::unique_ptr with a custom implementation
<memory> is a costly header we can avoid by just implementing
UniquePtr ourselves, which is a pretty straightforward in modern
C++, this saves around 10% of the compilation time here.
Diffstat (limited to 'src/highlighter.hh')
| -rw-r--r-- | src/highlighter.hh | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/highlighter.hh b/src/highlighter.hh index fbeef9e4..3583c788 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -9,8 +9,7 @@ #include "string.hh" #include "utils.hh" #include "parameters_parser.hh" - -#include <memory> +#include "unique_ptr.hh" namespace Kakoune { @@ -68,7 +67,7 @@ struct Highlighter virtual bool has_children() const; virtual Highlighter& get_child(StringView path); - virtual void add_child(String name, std::unique_ptr<Highlighter>&& hl, bool override = false); + virtual void add_child(String name, UniquePtr<Highlighter>&& hl, bool override = false); virtual void remove_child(StringView id); virtual Completions complete_child(StringView path, ByteCount cursor_pos, bool group) const; virtual void fill_unique_ids(Vector<StringView>& unique_ids) const; @@ -83,7 +82,7 @@ private: }; using HighlighterParameters = ConstArrayView<String>; -using HighlighterFactory = std::unique_ptr<Highlighter> (*)(HighlighterParameters params, Highlighter* parent); +using HighlighterFactory = UniquePtr<Highlighter> (*)(HighlighterParameters params, Highlighter* parent); struct HighlighterDesc { |
