Tweak utils.hh, remove unused index sequence
This commit is contained in:
parent
47df1374fe
commit
fbb326173a
34
src/utils.hh
34
src/utils.hh
|
@ -8,34 +8,6 @@
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename T, typename... Args>
|
|
||||||
std::unique_ptr<T> make_unique(Args&&... args)
|
|
||||||
{
|
|
||||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<size_t... I>
|
|
||||||
struct IndexSequence
|
|
||||||
{
|
|
||||||
using Next = IndexSequence<I..., sizeof...(I)>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<size_t N>
|
|
||||||
struct MakeIndexSequence
|
|
||||||
{
|
|
||||||
using Type = typename MakeIndexSequence<N-1>::Type::Next;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct MakeIndexSequence<0>
|
|
||||||
{
|
|
||||||
using Type = IndexSequence<>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<size_t N>
|
|
||||||
constexpr typename MakeIndexSequence<N>::Type
|
|
||||||
make_index_sequence() { return typename MakeIndexSequence<N>::Type{}; }
|
|
||||||
|
|
||||||
// *** Singleton ***
|
// *** Singleton ***
|
||||||
//
|
//
|
||||||
// Singleton helper class, every singleton type T should inherit
|
// Singleton helper class, every singleton type T should inherit
|
||||||
|
@ -109,6 +81,12 @@ OnScopeEnd<T> on_scope_end(T t)
|
||||||
|
|
||||||
// *** Misc helper functions ***
|
// *** Misc helper functions ***
|
||||||
|
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
std::unique_ptr<T> make_unique(Args&&... args)
|
||||||
|
{
|
||||||
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool operator== (const std::unique_ptr<T>& lhs, T* rhs)
|
bool operator== (const std::unique_ptr<T>& lhs, T* rhs)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user