cxxomfort  rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
Classes | Namespaces | Functions
iterator.hpp File Reference

Implementations and backports tied to <iterator>. More...

Classes

struct  is_contiguous_access_iterator< Iterator, Tag >
 Tags an iterator as a contiguous access type iterator. More...
 

Namespaces

 cxxomfort
 Namespace of the cxxomfort library.
 
 cxxomfort::cxxostd
 Backports made available by cxxomfort.
 
 cxxomfort::fix
 Fixes for implementation issues in std.
 

Functions

template<typename It >
CXXO_CONSTEXPR14 std::reverse_iterator< It > make_reverse_iterator (It i)
 Constructs the reverse_iterator for a given iterator. More...
 
template<typename T >
auto cdata (C const &container) -> decltype(container.data())
 Returns container.data() as a const-pointer for a given container. More...
 
template<typename It , typename = typename std::enable_if<std::is_pointer<It>::value, bool>>
constexpr It static_next (It const p) noexcept
 Given a compile-time const (or constexpr ) iterator, returns the iterator to the next position.
 
template<typename It , typename = typename std::enable_if<std::is_pointer<It>::value, bool>>
constexpr It static_prev (It const p) noexcept
 Given a compile-time const (or constexpr ) iterator, returns the iterator to the previous position. More...
 

Detailed Description

Implementations and backports tied to <iterator>.


Class Documentation

◆ cxxomfort::fix::is_contiguous_access_iterator

struct cxxomfort::fix::is_contiguous_access_iterator

template<typename Iterator, typename Tag = typename std::iterator_traits<Iterator>::iterator_category>
struct cxxomfort::fix::is_contiguous_access_iterator< Iterator, Tag >

Tags an iterator as a contiguous access type iterator.

Given an iterator type I, indicates whether the type either:

  • matches the contiguous_iterator_tag tag
  • or represents access to a contiguous area of memory, like an array

Pre C++17, this can only be implemented as an heuristic and can not determine contiguousness of storage types where the iterator is being wrapped, in which cases it will always declare false .

One such example is <array> and <vector> iterators in MSVC, in versions that don't support disabling the debug iterator mode.