alpha
This commit is contained in:
@ -37,11 +37,11 @@ namespace IACore {
|
||||
// Generic Primitive Reader (Read<UINT32>(), Read<FLOAT32>(), etc.)
|
||||
template <typename T>
|
||||
NO_DISCARD("Check for EOF")
|
||||
tl::expected<T, String> Read() {
|
||||
Expected<T, String> Read() {
|
||||
constexpr SIZE_T size = sizeof(T);
|
||||
|
||||
if B_UNLIKELY((m_cursor + size > m_span.size())) {
|
||||
return tl::make_unexpected(String("Unexpected EOF reading type"));
|
||||
return MakeUnexpected(String("Unexpected EOF reading type"));
|
||||
}
|
||||
|
||||
T value;
|
||||
|
||||
@ -220,11 +220,12 @@
|
||||
|
||||
// Templates and Aliases
|
||||
#ifdef __cplusplus
|
||||
# define ALIAS_FUNCTION(alias, function) \
|
||||
template<typename... Args> auto alias(Args &&...args) -> decltype(f(std::forward<Args>(args)...)) \
|
||||
{ \
|
||||
return function(std::forward<Args>(args)...); \
|
||||
}
|
||||
#define ALIAS_FUNCTION(alias, function) \
|
||||
template<typename... Args> \
|
||||
auto alias(Args &&...args) -> decltype(function(std::forward<Args>(args)...)) \
|
||||
{ \
|
||||
return function(std::forward<Args>(args)...); \
|
||||
}
|
||||
|
||||
# define ALIAS_TEMPLATE_FUNCTION(t, alias, function) \
|
||||
template<typename t, typename... Args> \
|
||||
@ -513,6 +514,10 @@ template<typename _key_type> using UnorderedSet = ankerl::unordered_dense::set<_
|
||||
template<typename _key_type, typename _value_type>
|
||||
using UnorderedMap = ankerl::unordered_dense::map<_key_type, _value_type>;
|
||||
|
||||
template<typename _expected_type, typename _unexpected_type>
|
||||
using Expected = tl::expected<_expected_type, _unexpected_type>;
|
||||
ALIAS_FUNCTION(MakeUnexpected, tl::make_unexpected);
|
||||
|
||||
using String = std::string;
|
||||
using StringView = std::string_view;
|
||||
using StringStream = std::stringstream;
|
||||
|
||||
Reference in New Issue
Block a user