fix meta
parent
209b97079c
commit
0aa686a87a
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
include(cmake/color.cmake)
|
||||||
set(BLT_VERSION 0.20.17)
|
set(BLT_VERSION 0.20.18)
|
||||||
set(BLT_TEST_VERSION 0.0.1)
|
set(BLT_TEST_VERSION 0.0.1)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
|
@ -189,6 +189,38 @@ namespace blt::meta
|
||||||
template<typename T, typename Or>
|
template<typename T, typename Or>
|
||||||
using const_reference_t = decltype(detail::const_reference_type_helper<Or>::template get<T>(0));
|
using const_reference_t = decltype(detail::const_reference_type_helper<Or>::template get<T>(0));
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct arrow_return
|
||||||
|
{
|
||||||
|
using type = typename std::result_of<decltype(&T::operator->)(T*)>::type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct arrow_return<T*>
|
||||||
|
{
|
||||||
|
using type = T*;
|
||||||
|
};
|
||||||
|
|
||||||
|
// gets the return type for arrow operator
|
||||||
|
template<typename T>
|
||||||
|
using arrow_return_t = typename arrow_return<T>::type;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct deref_return
|
||||||
|
{
|
||||||
|
using type = typename std::result_of<decltype(&T::operator*)(T*)>::type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct deref_return<T*>
|
||||||
|
{
|
||||||
|
using type = T&;
|
||||||
|
};
|
||||||
|
|
||||||
|
// gets the return type for the reference operator
|
||||||
|
template<typename T>
|
||||||
|
using deref_return_t = typename deref_return<T>::type;
|
||||||
|
|
||||||
#define BLT_META_MAKE_FUNCTION_CHECK(FUNC, ...)\
|
#define BLT_META_MAKE_FUNCTION_CHECK(FUNC, ...)\
|
||||||
template<typename T, typename = void> \
|
template<typename T, typename = void> \
|
||||||
class has_func_##FUNC : public std::false_type \
|
class has_func_##FUNC : public std::false_type \
|
||||||
|
|
|
@ -82,23 +82,24 @@ namespace blt
|
||||||
return current != other.current;
|
return current != other.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<blt::size_t, const_reference> operator*() const
|
std::pair<blt::size_t, blt::meta::deref_return_t<TYPE_ITR>> operator*() const
|
||||||
{
|
{
|
||||||
return {index, *current};
|
return {index, *current};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::pair<blt::size_t, reference> operator*()
|
std::pair<blt::size_t, blt::meta::deref_return_t<TYPE_ITR>> operator*()
|
||||||
{
|
{
|
||||||
return {index, *current};
|
return {index, *current};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: cleanup! all of this! add support for reversing
|
||||||
template<typename C1_TYPE, typename C2_TYPE>
|
template<typename C1_TYPE, typename C2_TYPE>
|
||||||
class pair_iterator
|
class pair_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using c1_ref = typename std::iterator_traits<C1_TYPE>::reference;
|
using c1_ref = blt::meta::deref_return_t<C1_TYPE>;
|
||||||
using c2_ref = typename std::iterator_traits<C2_TYPE>::reference;
|
using c2_ref = blt::meta::deref_return_t<C2_TYPE>;
|
||||||
|
|
||||||
using iterator_category = std::forward_iterator_tag;
|
using iterator_category = std::forward_iterator_tag;
|
||||||
using value_type = std::pair<c1_ref, c2_ref>;
|
using value_type = std::pair<c1_ref, c2_ref>;
|
||||||
|
|
Loading…
Reference in New Issue