forked from enlightenment/efl
eina-cxx: Added range_list to range types for eina-cxx
Added range_list which abstracts a ptr_list for wrapper types.
This commit is contained in:
parent
401cc81355
commit
e256a92eb1
|
@ -73,6 +73,100 @@ struct _ptr_eo_list_iterator : _ptr_list_iterator<Eo>
|
|||
using _base_type::native_handle;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
struct _eo_list_access_traits : _ptr_list_access_traits
|
||||
{
|
||||
template <typename T>
|
||||
struct iterator
|
||||
{
|
||||
typedef _ptr_eo_list_iterator<T> type;
|
||||
};
|
||||
template <typename T>
|
||||
struct const_iterator : iterator<T const> {};
|
||||
template <typename T>
|
||||
static T& back(Eina_List* list)
|
||||
{
|
||||
return *static_cast<T*>(static_cast<void*>(&eina_list_last(list)->data));
|
||||
}
|
||||
template <typename T>
|
||||
static T const& back(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::back<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static T& front(Eina_List* list)
|
||||
{
|
||||
return *static_cast<T*>(static_cast<void*>(&list->data));
|
||||
}
|
||||
template <typename T>
|
||||
static T const& front(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::front<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static typename iterator<T>::type begin(Eina_List* list)
|
||||
{
|
||||
return typename iterator<T>::type(list, list);
|
||||
}
|
||||
template <typename T>
|
||||
static typename iterator<T>::type end(Eina_List* list)
|
||||
{
|
||||
return typename iterator<T>::type(list, nullptr);
|
||||
}
|
||||
template <typename T>
|
||||
static typename const_iterator<T>::type begin(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::begin<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static typename const_iterator<T>::type end(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::end<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<typename iterator<T>::type> rbegin(Eina_List* list)
|
||||
{
|
||||
return std::reverse_iterator<typename iterator<T>::type>(_eo_list_access_traits::end<T>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<typename iterator<T>::type> rend(Eina_List* list)
|
||||
{
|
||||
return std::reverse_iterator<typename iterator<T>::type>(_eo_list_access_traits::begin<T>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<typename const_iterator<T>::type> rbegin(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::rbegin<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<typename const_iterator<T>::type> rend(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::rend<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static typename const_iterator<T>::type cbegin(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::begin<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static typename const_iterator<T>::type cend(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::end<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<typename const_iterator<T>::type> crbegin(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::rbegin<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<typename const_iterator<T>::type> crend(Eina_List const* list)
|
||||
{
|
||||
return _eo_list_access_traits::rend<T>(list);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename CloneAllocator = default_clone_allocator_placeholder, typename Enable = void>
|
||||
class list : ptr_list<T, typename std::conditional
|
||||
<std::is_same<CloneAllocator, default_clone_allocator_placeholder>::value
|
||||
|
@ -253,21 +347,21 @@ public:
|
|||
|
||||
reference front()
|
||||
{
|
||||
return *static_cast<pointer>(static_cast<void*>(&native_handle()->data));
|
||||
return _eo_list_access_traits::front<value_type>(native_handle());
|
||||
}
|
||||
reference back()
|
||||
{
|
||||
return *static_cast<pointer>(static_cast<void*>(&eina_list_last(native_handle())->data));
|
||||
return _eo_list_access_traits::back<value_type>(native_handle());
|
||||
}
|
||||
const_reference front() const { return const_cast<_self_type*>(this)->front(); }
|
||||
const_reference back() const { return const_cast<_self_type*>(this)->back(); }
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(native_handle(), native_handle());
|
||||
return _eo_list_access_traits::begin<value_type>(native_handle());
|
||||
}
|
||||
iterator end()
|
||||
{
|
||||
return iterator(native_handle(), nullptr);
|
||||
return _eo_list_access_traits::end<value_type>(native_handle());
|
||||
}
|
||||
const_iterator begin() const
|
||||
{
|
||||
|
@ -287,11 +381,11 @@ public:
|
|||
}
|
||||
reverse_iterator rbegin()
|
||||
{
|
||||
return reverse_iterator(end());
|
||||
return _eo_list_access_traits::rbegin<value_type>(native_handle());
|
||||
}
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
return _eo_list_access_traits::rend<value_type>(native_handle());
|
||||
}
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
|
@ -325,6 +419,160 @@ bool operator!=(list<T, CloneAllocator> const& rhs, list<T, CloneAllocator> cons
|
|||
return !(rhs == lhs);
|
||||
}
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
class range_list : range_ptr_list<T>
|
||||
{
|
||||
typedef range_ptr_list<T> _base_type;
|
||||
public:
|
||||
typedef typename _base_type::value_type value_type;
|
||||
typedef typename _base_type::reference reference;
|
||||
typedef typename _base_type::const_reference const_reference;
|
||||
typedef typename _base_type::const_iterator const_iterator;
|
||||
typedef typename _base_type::iterator iterator;
|
||||
typedef typename _base_type::pointer pointer;
|
||||
typedef typename _base_type::const_pointer const_pointer;
|
||||
typedef typename _base_type::size_type size_type;
|
||||
typedef typename _base_type::difference_type difference_type;
|
||||
typedef typename _base_type::clone_allocator_type clone_allocator_type;
|
||||
|
||||
typedef typename _base_type::reverse_iterator reverse_iterator;
|
||||
typedef typename _base_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
using _base_type::_base_type;
|
||||
using _base_type::clear;
|
||||
using _base_type::size;
|
||||
using _base_type::empty;
|
||||
using _base_type::get_clone_allocator;
|
||||
using _base_type::push_back;
|
||||
using _base_type::push_front;
|
||||
using _base_type::pop_back;
|
||||
using _base_type::pop_front;
|
||||
using _base_type::insert;
|
||||
using _base_type::erase;
|
||||
using _base_type::assign;
|
||||
using _base_type::back;
|
||||
using _base_type::front;
|
||||
using _base_type::begin;
|
||||
using _base_type::end;
|
||||
using _base_type::rbegin;
|
||||
using _base_type::rend;
|
||||
using _base_type::cbegin;
|
||||
using _base_type::cend;
|
||||
using _base_type::crbegin;
|
||||
using _base_type::crend;
|
||||
using _base_type::ibegin;
|
||||
using _base_type::iend;
|
||||
using _base_type::cibegin;
|
||||
using _base_type::ciend;
|
||||
using _base_type::swap;
|
||||
using _base_type::max_size;
|
||||
using _base_type::native_handle;
|
||||
using _base_type::accessor;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class range_list<T, typename std::enable_if<std::is_base_of<efl::eo::base, T>::value>::type>
|
||||
: range_ptr_list<Eo>
|
||||
{
|
||||
typedef range_ptr_list<Eo> _base_type;
|
||||
typedef range_list<T> _self_type;
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef value_type& reference;
|
||||
typedef value_type const& const_reference;
|
||||
typedef _ptr_eo_list_iterator<value_type const> const_iterator;
|
||||
typedef _ptr_eo_list_iterator<value_type> iterator;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type const* const_pointer;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
explicit range_list(Eina_List* handle)
|
||||
: _base_type(handle) {}
|
||||
range_list() {}
|
||||
range_list(range_list<T> const& other)
|
||||
: _base_type(other.native_handle())
|
||||
{
|
||||
}
|
||||
range_list<T>& operator=(range_list<T>const& other)
|
||||
{
|
||||
_base_type::_handle = other._handle;
|
||||
return *this;
|
||||
}
|
||||
|
||||
using _base_type::size;
|
||||
using _base_type::empty;
|
||||
|
||||
reference front()
|
||||
{
|
||||
return _eo_list_access_traits::front<value_type>(native_handle());
|
||||
}
|
||||
reference back()
|
||||
{
|
||||
return _eo_list_access_traits::back<value_type>(native_handle());
|
||||
}
|
||||
const_reference front() const { return const_cast<_self_type*>(this)->front(); }
|
||||
const_reference back() const { return const_cast<_self_type*>(this)->back(); }
|
||||
iterator begin()
|
||||
{
|
||||
return _eo_list_access_traits::begin<value_type>(native_handle());
|
||||
}
|
||||
iterator end()
|
||||
{
|
||||
return _eo_list_access_traits::end<value_type>(native_handle());
|
||||
}
|
||||
const_iterator begin() const
|
||||
{
|
||||
return const_cast<_self_type*>(this)->begin();
|
||||
}
|
||||
const_iterator end() const
|
||||
{
|
||||
return const_cast<_self_type*>(this)->end();
|
||||
}
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return begin();
|
||||
}
|
||||
const_iterator cend() const
|
||||
{
|
||||
return end();
|
||||
}
|
||||
reverse_iterator rbegin()
|
||||
{
|
||||
return _eo_list_access_traits::rbegin<value_type>(native_handle());
|
||||
}
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return _eo_list_access_traits::rend<value_type>(native_handle());
|
||||
}
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return const_cast<_self_type*>(this)->rbegin();
|
||||
}
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_cast<_self_type*>(this)->rend();
|
||||
}
|
||||
const_reverse_iterator crbegin() const
|
||||
{
|
||||
return rbegin();
|
||||
}
|
||||
const_reverse_iterator crend() const
|
||||
{
|
||||
return rend();
|
||||
}
|
||||
using _base_type::swap;
|
||||
using _base_type::native_handle;
|
||||
|
||||
friend bool operator==(range_list<T> const& rhs, range_list<T> const& lhs)
|
||||
{
|
||||
return rhs.size() == lhs.size() && std::equal(rhs.begin(), rhs.end(), lhs.begin());
|
||||
}
|
||||
};
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -120,295 +120,149 @@ struct _ptr_list_iterator : _ptr_list_iterator_base
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
struct _ptr_list_access_traits {
|
||||
|
||||
template <typename T>
|
||||
struct iterator
|
||||
struct _ptr_list_access_traits
|
||||
{
|
||||
template <typename T>
|
||||
struct iterator
|
||||
{
|
||||
typedef _ptr_list_iterator<T> type;
|
||||
};
|
||||
template <typename T>
|
||||
struct const_iterator : iterator<T const> {};
|
||||
template <typename T>
|
||||
struct native_handle
|
||||
{
|
||||
};
|
||||
template <typename T>
|
||||
struct const_iterator : iterator<T const> {};
|
||||
template <typename T>
|
||||
struct native_handle
|
||||
{
|
||||
typedef Eina_List* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct const_native_handle
|
||||
{
|
||||
};
|
||||
template <typename T>
|
||||
struct const_native_handle
|
||||
{
|
||||
typedef Eina_List const* type;
|
||||
};
|
||||
template <typename T>
|
||||
static Eina_List* native_handle_from_const(Eina_List const* list)
|
||||
{
|
||||
};
|
||||
template <typename T>
|
||||
static Eina_List* native_handle_from_const(Eina_List const* list)
|
||||
{
|
||||
return const_cast<Eina_List*>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static T& back(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static T& back(Eina_List* list)
|
||||
{
|
||||
return *static_cast<T*>(eina_list_data_get(eina_list_last(list)));
|
||||
}
|
||||
template <typename T>
|
||||
static T const& back(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static T const& back(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::back<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static T& front(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static T& front(Eina_List* list)
|
||||
{
|
||||
return *static_cast<T*>(eina_list_data_get(list));
|
||||
}
|
||||
template <typename T>
|
||||
static T const& front(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static T const& front(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::front<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T> begin(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T> begin(Eina_List* list)
|
||||
{
|
||||
return _ptr_list_iterator<T>(list, list);
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T> end(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T> end(Eina_List* list)
|
||||
{
|
||||
return _ptr_list_iterator<T>(list, 0);
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> begin(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> begin(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::begin<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> end(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> end(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::end<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T> > rbegin(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T> > rbegin(Eina_List* list)
|
||||
{
|
||||
return std::reverse_iterator<_ptr_list_iterator<T> >(_ptr_list_access_traits::end<T>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T> > rend(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T> > rend(Eina_List* list)
|
||||
{
|
||||
return std::reverse_iterator<_ptr_list_iterator<T> >(_ptr_list_access_traits::begin<T>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > rbegin(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > rbegin(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::rbegin<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > rend(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > rend(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::rend<T>(const_cast<Eina_List*>(list));
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> cbegin(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> cbegin(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::begin<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> cend(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static _ptr_list_iterator<T const> cend(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::end<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > crbegin(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > crbegin(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::rbegin<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > crend(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::reverse_iterator<_ptr_list_iterator<T const> > crend(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::rend<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T> ibegin(Eina_List* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T> ibegin(Eina_List* list)
|
||||
{
|
||||
return eina::iterator<T>( ::eina_list_iterator_new(list) );
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T> iend(Eina_List*)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T> iend(Eina_List*)
|
||||
{
|
||||
return eina::iterator<T>();
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> ibegin(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> ibegin(Eina_List const* list)
|
||||
{
|
||||
return eina::iterator<T const>( ::eina_list_iterator_new(list) );
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> iend(Eina_List const*)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> iend(Eina_List const*)
|
||||
{
|
||||
return eina::iterator<T const>();
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> cibegin(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> cibegin(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::ibegin<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> ciend(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static eina::iterator<T const> ciend(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::iend<T>(list);
|
||||
}
|
||||
template <typename T>
|
||||
static std::size_t size(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static std::size_t size(Eina_List const* list)
|
||||
{
|
||||
return eina_list_count(list);
|
||||
}
|
||||
template <typename T>
|
||||
static bool empty(Eina_List const* list)
|
||||
{
|
||||
}
|
||||
template <typename T>
|
||||
static bool empty(Eina_List const* list)
|
||||
{
|
||||
return _ptr_list_access_traits::size<T>(list) == 0u;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
template <typename T>
|
||||
struct _const_range_ptr_list
|
||||
{
|
||||
typedef _ptr_list_iterator<T const> const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T const& const_reference;
|
||||
typedef T* pointer;
|
||||
typedef T const* const_pointer;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef const_reverse_iterator reverse_iterator;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
typedef Eina_List const* native_handle_type;
|
||||
typedef _const_range_ptr_list<T> _self_type;
|
||||
|
||||
_const_range_ptr_list(native_handle_type list)
|
||||
: _list(list) {}
|
||||
|
||||
native_handle_type native_handle() const { return _list; }
|
||||
value_type const& back() const
|
||||
{
|
||||
return _ptr_list_access_traits::back<value_type>(_list);
|
||||
}
|
||||
value_type const& front() const
|
||||
{
|
||||
return _ptr_list_access_traits::front<value_type>(_list);
|
||||
}
|
||||
const_iterator begin() const
|
||||
{
|
||||
return _ptr_list_access_traits::begin<value_type>(_list);
|
||||
}
|
||||
const_iterator end() const
|
||||
{
|
||||
return _ptr_list_access_traits::end<value_type>(_list);
|
||||
}
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return _ptr_list_access_traits::rbegin<value_type>(_list);
|
||||
}
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return _ptr_list_access_traits::rend<value_type>(_list);
|
||||
}
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return _ptr_list_access_traits::cbegin<value_type>(_list);
|
||||
}
|
||||
const_iterator cend() const
|
||||
{
|
||||
return _ptr_list_access_traits::cend<value_type>(_list);
|
||||
}
|
||||
const_reverse_iterator crbegin() const
|
||||
{
|
||||
return _ptr_list_access_traits::crbegin<value_type>(_list);
|
||||
}
|
||||
const_reverse_iterator crend() const
|
||||
{
|
||||
return _ptr_list_access_traits::crend<value_type>(_list);
|
||||
}
|
||||
void swap(_self_type& other)
|
||||
{
|
||||
std::swap(_list, other._list);
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
return _ptr_list_access_traits::empty<T>(_list);
|
||||
}
|
||||
size_type size() const
|
||||
{
|
||||
return _ptr_list_access_traits::size<T>(_list);
|
||||
}
|
||||
|
||||
native_handle_type _list;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
template <typename T>
|
||||
void swap(_const_range_ptr_list<T>& lhs, _const_range_ptr_list<T>& rhs)
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
template <typename T>
|
||||
struct _mutable_range_ptr_list : _const_range_ptr_list<T>
|
||||
{
|
||||
typedef _const_range_ptr_list<T> _base_type;
|
||||
typedef T value_type;
|
||||
typedef _ptr_list_iterator<T> iterator;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef typename _base_type::const_iterator const_iterator;
|
||||
typedef typename _base_type::const_reference const_reference;
|
||||
typedef typename _base_type::const_pointer const_pointer;
|
||||
typedef typename _base_type::const_reverse_iterator const_reverse_iterator;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
typedef Eina_List* native_handle_type;
|
||||
typedef _mutable_range_ptr_list<T> _self_type;
|
||||
|
||||
_mutable_range_ptr_list(native_handle_type list)
|
||||
: _base_type(list) {}
|
||||
|
||||
native_handle_type native_handle() const
|
||||
{
|
||||
return const_cast<native_handle_type>(_base_type::native_handle());
|
||||
}
|
||||
value_type& back() const
|
||||
{
|
||||
return _ptr_list_access_traits::back<value_type>(native_handle());
|
||||
}
|
||||
value_type& front() const
|
||||
{
|
||||
return _ptr_list_access_traits::front<value_type>(native_handle());
|
||||
}
|
||||
iterator begin() const
|
||||
{
|
||||
return _ptr_list_access_traits::begin<value_type>(native_handle());
|
||||
}
|
||||
iterator end() const
|
||||
{
|
||||
return _ptr_list_access_traits::end<value_type>(native_handle());
|
||||
}
|
||||
reverse_iterator rbegin() const
|
||||
{
|
||||
return _ptr_list_access_traits::rbegin<value_type>(native_handle());
|
||||
}
|
||||
reverse_iterator rend() const
|
||||
{
|
||||
return _ptr_list_access_traits::rend<value_type>(native_handle());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -389,6 +389,7 @@ struct _range_template : private std::conditional
|
|||
using _base_type::crend;
|
||||
using _base_type::empty;
|
||||
using _base_type::size;
|
||||
using _base_type::swap;
|
||||
protected:
|
||||
using _base_type::_handle;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue