90template<
typename T,
typename W>
102 return wrapper.raw();
111template<
typename T,
typename W>
141 typename N = DefaultNextElement<T>,
142 typename C = DefaultWrapperCast<T, W>,
143 typename R = DefaultResetPtr<T, W>,
144 typename D = NullDeleter<T>,
145 typename I = std::forward_iterator_tag>
164 template<
bool constIterator = false>
178 std::iterator_traits<base_iterator>
d;
183 using value_type =
typename std::conditional<constIterator, const element_wrapper_type, element_wrapper_type>::type;
192 using ElementType =
typename std::conditional<constIterator, const element_type, element_type>::type;
193 using WrapperType =
typename std::conditional<constIterator, const element_wrapper_type, element_wrapper_type>::type;
209 resetPtr(wrapper, ptr);
222 ptr = getNextPtr(ptr);
223 resetPtr(wrapper, ptr);
395 return std::distance(
begin(),
end());
405 size_t size =
count();
410 std::advance(it, idx);
Iterator over the list.
Definition linkedlistutils.h:174
typename std::conditional< constIterator, const element_wrapper_type, element_wrapper_type >::type value_type
Type produced by dereferencing.
Definition linkedlistutils.h:183
WrapperType * operator->() noexcept
Element at the current position.
Definition linkedlistutils.h:272
base_iterator operator++(int)
Advance, returning the previous position.
Definition linkedlistutils.h:233
WrapperType & operator*() noexcept
Element at the current position.
Definition linkedlistutils.h:262
base_iterator & operator++()
Advance to the next element.
Definition linkedlistutils.h:220
ptrdiff_t difference_type
Distance type required by the iterator traits.
Definition linkedlistutils.h:185
bool operator!=(const base_iterator &rhs) const
Compare positions.
Definition linkedlistutils.h:255
base_iterator(element_type *ptr)
Point the iterator at an element.
Definition linkedlistutils.h:206
bool operator==(const base_iterator &rhs) const
Compare positions.
Definition linkedlistutils.h:247
value_type * pointer
Pointer to the wrapper.
Definition linkedlistutils.h:187
std::iterator_traits< base_iterator > d
Definition linkedlistutils.h:178
iterator_category iterator_category
Category of the iteration.
Definition linkedlistutils.h:181
value_type & reference
Reference to the wrapper.
Definition linkedlistutils.h:189
Universal wrapper for one directional linked list elements.
Definition linkedlistutils.h:147
element_type * raw()
The first element of the list.
Definition linkedlistutils.h:328
W element_wrapper_type
avcpp wrapper returned when the iterator is dereferenced.
Definition linkedlistutils.h:152
base_iterator< false > iterator
Mutable iterator over the list.
Definition linkedlistutils.h:280
iterator begin()
First element.
Definition linkedlistutils.h:348
element_type * m_begin
First element of the list; owned when the deleter frees it.
Definition linkedlistutils.h:419
LinkedListWrapper(element_type *begin)
Take ownership of a list.
Definition linkedlistutils.h:299
D deleter_type
Deleter called by the destructor.
Definition linkedlistutils.h:160
iterator end()
End of the list.
Definition linkedlistutils.h:359
wrapper_cast_type m_wrapperCast
Functor used to obtain the raw pointer of a wrapper.
Definition linkedlistutils.h:417
element_type * m_end
Last element the wrapper was constructed with.
Definition linkedlistutils.h:421
N next_element_type
Functor that produces the next element.
Definition linkedlistutils.h:154
const_iterator end() const
End of the list, read-only.
Definition linkedlistutils.h:381
size_t count() const
Number of elements in the list.
Definition linkedlistutils.h:393
C wrapper_cast_type
Functor used to obtain the raw pointer of a wrapper.
Definition linkedlistutils.h:156
R wrapper_reset_type
Functor used to point a wrapper at another element.
Definition linkedlistutils.h:158
bool isValid()
Whether the wrapper holds a list.
Definition linkedlistutils.h:318
I iterator_category
Iterator category forwarded to the iterator traits.
Definition linkedlistutils.h:162
element_wrapper_type at(size_t idx) const
Log(N) complexity.
Definition linkedlistutils.h:403
const_iterator begin() const
First element, read-only.
Definition linkedlistutils.h:370
LinkedListWrapper()
Create an empty wrapper that owns nothing.
Definition linkedlistutils.h:287
const element_type * raw() const
The first element of the list, read-only.
Definition linkedlistutils.h:338
T element_type
Type of the list element, as FFmpeg declares it.
Definition linkedlistutils.h:150
base_iterator< true > const_iterator
Read-only iterator over the list.
Definition linkedlistutils.h:282
Root namespace of the library.
Definition audioresampler.h:19
This functor uses simple notation to take next element from linked list.
Definition linkedlistutils.h:52
T * operator()(T *x) const
Follow the next field of an intrusive list.
Definition linkedlistutils.h:60
This functor used by default to set new pointer that will be wrapped by W wrapper.
Definition linkedlistutils.h:113
void operator()(W &wrapper, T *ptr) const
Point a wrapper at another element.
Definition linkedlistutils.h:120
This functor used by default to take access to raw pointer that wrapped by W wrapper.
Definition linkedlistutils.h:92
T * operator()(const W &wrapper) const
Extract the raw pointer from a wrapper.
Definition linkedlistutils.h:100
This functor uses increment operation to take next element in list/array.
Definition linkedlistutils.h:72
T * operator()(T *x) const
Step to the next element of a contiguous array.
Definition linkedlistutils.h:80
This deleter does nothing.
Definition linkedlistutils.h:19
void operator()(T *) const
Do nothing.
Definition linkedlistutils.h:23
This deleter simple call 'delete' operator.
Definition linkedlistutils.h:33
void operator()(T *x) const
Delete the element.
Definition linkedlistutils.h:39