v1
Brett 2024-09-23 16:24:22 -04:00
parent 209b97079c
commit 0aa686a87a
3 changed files with 38 additions and 5 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
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_TARGET BLT)

View File

@ -188,6 +188,38 @@ namespace blt::meta
using reference_t = decltype(detail::reference_type_helper<Or>::template get<T>(0));
template<typename T, typename Or>
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, ...)\
template<typename T, typename = void> \

View File

@ -82,23 +82,24 @@ namespace blt
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};
};
std::pair<blt::size_t, reference> operator*()
std::pair<blt::size_t, blt::meta::deref_return_t<TYPE_ITR>> operator*()
{
return {index, *current};
};
};
// TODO: cleanup! all of this! add support for reversing
template<typename C1_TYPE, typename C2_TYPE>
class pair_iterator
{
public:
using c1_ref = typename std::iterator_traits<C1_TYPE>::reference;
using c2_ref = typename std::iterator_traits<C2_TYPE>::reference;
using c1_ref = blt::meta::deref_return_t<C1_TYPE>;
using c2_ref = blt::meta::deref_return_t<C2_TYPE>;
using iterator_category = std::forward_iterator_tag;
using value_type = std::pair<c1_ref, c2_ref>;