diff --git a/src/Makefile b/src/Makefile index e30c6f2b9..6da2d7964 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ bindir := $(DESTDIR)$(PREFIX)/bin sharedir := $(DESTDIR)$(PREFIX)/share/kak docdir := $(DESTDIR)$(PREFIX)/share/doc/kak -CXXFLAGS += -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare -pedantic +CXXFLAGS += -std=c++14 -g -Wall -Wno-reorder -Wno-sign-compare -pedantic ifneq (,$(findstring CYGWIN,$(os))) LDFLAGS += -rdynamic endif diff --git a/src/client_manager.cc b/src/client_manager.cc index ecade79c5..edb3251ec 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -84,7 +84,7 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer) { return &ws.window->buffer() == &buffer; }); if (it == m_free_windows.rend()) - return { make_unique(buffer), { buffer, Selection{} } }; + return { std::make_unique(buffer), { buffer, Selection{} } }; it->window->forget_timestamp(); WindowAndSelections res = std::move(*it); diff --git a/src/containers.hh b/src/containers.hh index 56e5fc1f8..0f94dba7b 100644 --- a/src/containers.hh +++ b/src/containers.hh @@ -91,7 +91,7 @@ using TransformedResult = decltype(std::declval()(*std::declval())); template struct TransformedIterator : std::iterator>::type> + std::remove_reference_t>> { TransformedIterator(Transform transform, Iterator it) : m_it(std::move(it)), m_transform(std::move(transform)) {} diff --git a/src/flags.hh b/src/flags.hh index 2b68751bd..f3562d953 100644 --- a/src/flags.hh +++ b/src/flags.hh @@ -10,21 +10,18 @@ template struct WithBitOps : std::false_type {}; template -using UnderlyingType = typename std::underlying_type::type; - -template -using EnableIfWithBitOps = typename std::enable_if::value>::type; +using EnableIfWithBitOps = std::enable_if_t::value>; template> constexpr Flags operator|(Flags lhs, Flags rhs) { - return (Flags)((UnderlyingType) lhs | (UnderlyingType) rhs); + return (Flags)((std::underlying_type_t) lhs | (std::underlying_type_t) rhs); } template> Flags& operator|=(Flags& lhs, Flags rhs) { - (UnderlyingType&) lhs |= (UnderlyingType) rhs; + (std::underlying_type_t&) lhs |= (std::underlying_type_t) rhs; return lhs; } @@ -32,27 +29,27 @@ template struct TestableFlags { Flags value; - constexpr operator bool() const { return (UnderlyingType)value; } + constexpr operator bool() const { return (std::underlying_type_t)value; } constexpr operator Flags() const { return value; } }; template> constexpr TestableFlags operator&(Flags lhs, Flags rhs) { - return { (Flags)((UnderlyingType) lhs & (UnderlyingType) rhs) }; + return { (Flags)((std::underlying_type_t) lhs & (std::underlying_type_t) rhs) }; } template> Flags& operator&=(Flags& lhs, Flags rhs) { - (UnderlyingType&) lhs &= (UnderlyingType) rhs; + (std::underlying_type_t&) lhs &= (std::underlying_type_t) rhs; return lhs; } template> constexpr Flags operator~(Flags lhs) { - return (Flags)(~(UnderlyingType)lhs); + return (Flags)(~(std::underlying_type_t)lhs); } } diff --git a/src/hash.hh b/src/hash.hh index 3fc8abd2a..232baea56 100644 --- a/src/hash.hh +++ b/src/hash.hh @@ -19,10 +19,10 @@ size_t hash_value(const Type&... val) } template -typename std::enable_if::value, size_t>::type +std::enable_if_t::value, size_t> hash_value(const Type& val) { - return hash_value((typename std::underlying_type::type)val); + return hash_value((std::underlying_type_t)val); } template diff --git a/src/highlighter.hh b/src/highlighter.hh index 4e259c510..ddd2a78bd 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -61,7 +61,7 @@ private: template std::unique_ptr> make_simple_highlighter(T func) { - return make_unique>(std::move(func)); + return std::make_unique>(std::move(func)); } using HighlighterParameters = ConstArrayView; diff --git a/src/highlighters.cc b/src/highlighters.cc index 93cb0e4da..286b22c6d 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -272,8 +272,8 @@ public: Regex ex{params[0].begin(), params[0].end(), Regex::optimize}; - return {id, make_unique(std::move(ex), - std::move(faces))}; + return {id, std::make_unique(std::move(ex), + std::move(faces))}; } catch (RegexError& err) { @@ -447,7 +447,7 @@ template std::unique_ptr> make_dynamic_regex_highlighter(RegexGetter regex_getter, FaceGetter face_getter) { - return make_unique>( + return std::make_unique>( std::move(regex_getter), std::move(face_getter)); } @@ -896,7 +896,7 @@ HighlighterAndId create_highlighter_group(HighlighterParameters params) if (params.size() != 1) throw runtime_error("wrong parameter count"); - return HighlighterAndId(params[0], make_unique()); + return HighlighterAndId(params[0], std::make_unique()); } HighlighterAndId create_reference_highlighter(HighlighterParameters params) @@ -1200,7 +1200,7 @@ public: } auto default_group = parser.get_switch("default").value_or(StringView{}).str(); - return {parser[0], make_unique(std::move(regions), default_group)}; + return {parser[0], std::make_unique(std::move(regions), default_group)}; } catch (RegexError& err) { diff --git a/src/main.cc b/src/main.cc index 7b1f62f98..c8fc9d03e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -261,7 +261,7 @@ void create_local_client(StringView init_command) } static Client* client = ClientManager::instance().create_client( - make_unique(), get_env_vars(), init_command); + std::make_unique(), get_env_vars(), init_command); signal(SIGHUP, [](int) { if (client) ClientManager::instance().remove_client(*client); @@ -299,7 +299,7 @@ int run_client(StringView session, StringView init_command) try { EventManager event_manager; - RemoteClient client{session, make_unique(), + RemoteClient client{session, std::make_unique(), get_env_vars(), init_command}; while (true) event_manager.handle_next_events(EventMode::Normal); diff --git a/src/safe_ptr.hh b/src/safe_ptr.hh index 2e3b3d2b6..5fe894b3b 100644 --- a/src/safe_ptr.hh +++ b/src/safe_ptr.hh @@ -94,8 +94,7 @@ private: }; template using SafePtr = - RefPtr::value, - const SafeCountable, SafeCountable>::type>; + RefPtr::value, const SafeCountable, SafeCountable>>; } diff --git a/src/string.hh b/src/string.hh index b5ad8e5a9..e2e2d412b 100644 --- a/src/string.hh +++ b/src/string.hh @@ -297,10 +297,10 @@ namespace detail template using IsString = std::is_convertible; -template::value>::type> +template::value>> auto format_param(const T& val) -> decltype(to_string(val)) { return to_string(val); } -template::value>::type> +template::value>> StringView format_param(const T& val) { return val; } } diff --git a/src/utils.hh b/src/utils.hh index ee2591c04..7a7eb0711 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -8,34 +8,6 @@ namespace Kakoune { -template -std::unique_ptr make_unique(Args&&... args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} - -template -struct IndexSequence -{ - using Next = IndexSequence; -}; - -template -struct MakeIndexSequence -{ - using Type = typename MakeIndexSequence::Type::Next; -}; - -template<> -struct MakeIndexSequence<0> -{ - using Type = IndexSequence<>; -}; - -template -constexpr typename MakeIndexSequence::Type -make_index_sequence() { return typename MakeIndexSequence::Type{}; } - // *** Singleton *** // // Singleton helper class, every singleton type T should inherit