Skip to content

Commit e1d4fb1

Browse files
committed
Some changes around
* Moved all definitions from <variadic.h> to <types.h>. * Removed <variadic.h>.
1 parent 9682337 commit e1d4fb1

File tree

3 files changed

+46
-75
lines changed

3 files changed

+46
-75
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
=== 1.0.45 ===
66
* Added strend() function for returning pointer to the end of C string.
77
* Added strmemdup() function for converting sequence of bytes to C string.
8+
* Moved all definitions from <variadic.h> to <types.h>.
9+
* Removed <variadic.h>.
810

911
=== 1.0.44 ===
1012
* Some improvement around endianess conversion functions.

include/lsp-plug.in/common/types.h

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,16 +906,55 @@ namespace lsp
906906
// Library exports, for built-in modules there are no exports
907907
namespace lsp
908908
{
909+
// lsp::remove_reference
909910
template <class T>
910-
inline void swap(T &a, T &b)
911+
struct remove_reference
911912
{
912-
T tmp = a;
913-
a = b;
914-
b = tmp;
913+
typedef T type;
914+
};
915+
916+
template <class T>
917+
struct remove_reference<T&>
918+
{
919+
typedef T type;
920+
};
921+
922+
template <class T>
923+
struct remove_reference<T&&>
924+
{
925+
typedef T type;
926+
};
927+
928+
// lsp::move
929+
template <typename T>
930+
typename remove_reference<T>::type && move(T && t) noexcept
931+
{
932+
return static_cast<typename remove_reference<T>::type &&>(t);
933+
}
934+
935+
// lsp::forward
936+
template<typename T>
937+
constexpr T && forward(typename remove_reference<T>::type && args) noexcept
938+
{
939+
return static_cast<T &&>(args);
940+
}
941+
942+
template<typename T>
943+
constexpr T && forward(typename remove_reference<T>::type & args) noexcept
944+
{
945+
return static_cast<T &&>(args);
946+
}
947+
948+
template <class T>
949+
inline void swap(T & a, T & b) noexcept
950+
{
951+
T tmp = lsp::move(a);
952+
a = lsp::move(b);
953+
b = lsp::move(tmp);
915954
}
916955

917956
template <class T>
918-
inline T *release(T * &a)
957+
inline T *release(T * &a) noexcept
919958
{
920959
T *tmp = a;
921960
a = NULL;

include/lsp-plug.in/common/variadic.h

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)