OGLplus  (0.59.0) a C++ wrapper for rendering APIs

span.hpp File Reference
#include "../anything.hpp"
#include "../assert.hpp"
#include "../compare.hpp"
#include "../extract.hpp"
#include "../int_constant.hpp"
#include "../type_identity.hpp"
#include "../types.hpp"
#include "address.hpp"
#include <cstring>
#include <initializer_list>
#include <iterator>
#include <type_traits>

Go to the source code of this file.

Classes

struct  eagine::memory::has_span_size_member< T >
 Helper class detecting if type T has x.size() member function. More...
 
struct  eagine::memory::has_span_data_member< T, E >
 Helper class detecting if type T has x.data() member function. More...
 
class  eagine::memory::basic_span< ValueType, Pointer, SizeType >
 Non-owning view of a contiguous range of memory with ValueType elements. More...
 

Namespaces

 eagine
 Common code is placed in this namespace.
 

Typedefs

template<typename T , typename S = span_size_t>
using eagine::memory::span = basic_span< T, T *, S >
 Default alias for basic memory spans with native pointer type.
 
template<typename T >
using eagine::memory::span_if_mutable = std::enable_if_t<!std::is_const_v< T >, span< T > >
 Alias for span<T> if T is mutable type. Ill defined otherwise.
 
template<typename T >
using eagine::memory::const_span = span< std::add_const_t< T > >
 Alias for spans with const element type.
 

Functions

template<typename T , typename P , typename S >
static constexpr auto eagine::memory::absolute (basic_span< T, P, S > spn) noexcept -> basic_span< T, T *, S >
 Converts argument to span using a native pointer type. More...
 
template<typename T >
static constexpr auto eagine::memory::view_one (const T &value) noexcept -> const_span< T >
 Creates a single-const-element view over the specified value.
 
template<typename T >
static constexpr auto eagine::memory::cover_one (T &value) noexcept -> span_if_mutable< T >
 Creates a single-element mutable span over the specified value.
 
template<typename T >
static constexpr auto eagine::memory::view_one (const T *pointer) noexcept -> const_span< T >
 Creates a single-const-element view from the specified pointer.
 
template<typename T >
static constexpr auto eagine::memory::cover_one (T *pointer) noexcept -> span_if_mutable< T >
 Creates a single-element mutable span from the specified pointer.
 
template<typename T , typename S >
static constexpr auto eagine::memory::view (T *addr, S size) noexcept -> const_span< T >
 Creates a view starting at the specified pointer and specified length.
 
template<typename T , typename S >
static constexpr auto eagine::memory::cover (T *addr, S size) noexcept -> span_if_mutable< T >
 Creates a span starting at the specified pointer and specified length.
 
template<typename T , typename S >
static constexpr auto eagine::memory::view (const_address addr, S size) noexcept -> const_span< T >
 Creates a view starting at the specified address and specified length.
 
template<typename T , typename S >
static constexpr auto eagine::memory::cover (address addr, S size) noexcept -> span_if_mutable< T >
 Creates a span starting at the specified address and specified length.
 
template<typename T , std::size_t N>
static constexpr auto eagine::memory::view (const T(&array)[N]) noexcept -> const_span< T >
 Creates a const view over the specified fixed-size array.
 
template<typename T , std::size_t N>
static constexpr auto eagine::memory::cover (T(&array)[N]) noexcept -> span_if_mutable< T >
 Creates a mutable span covering the specified fixed-size array.
 
template<typename T >
static constexpr auto eagine::memory::view (std::initializer_list< T > il) noexcept -> const_span< T >
 Creates a const view over the specified initializer list.
 
template<typename C , typename = std::enable_if_t<has_span_data_member_v<C> && has_span_size_member_v<C>>>
static constexpr auto eagine::memory::view (const C &container) noexcept
 Creates a const view over a compatible contiguous container.
 
template<typename C , typename = std::enable_if_t<has_span_data_member_v<C> && has_span_size_member_v<C>>>
static constexpr auto eagine::memory::cover (C &container) noexcept
 Creates a mutable span covering a compatible contiguous container.
 
template<typename T , typename B , typename P , typename S >
static constexpr auto eagine::memory::can_accomodate (basic_span< B, P, S > blk, span_size_t count, type_identity< T > tid={}) noexcept
 Indicates if the specified memory block can accomodate count elements of T.
 
template<typename T , typename B , typename P , typename S >
static constexpr auto eagine::memory::can_accomodate (basic_span< B, P, S > blk, type_identity< T > tid={}) noexcept
 Indicates if the specified memory block can accomodate one element of T.
 
template<typename T , typename B , typename P , typename S >
static constexpr auto eagine::memory::accomodate (basic_span< B, P, S > blk, type_identity< T > tid={}) noexcept -> basic_span< std::add_const_t< T >, rebind_pointer_t< P, T >, S >
 Returns a span, rebinding the element type (typically from basic_block). More...
 
template<typename T , typename P , typename S >
static constexpr auto eagine::memory::extract (basic_span< T, P, S > spn) noexcept -> T &
 Overload of extract for spans. Returns the first element,. More...
 
template<typename T , typename P , typename S >
static constexpr auto eagine::memory::extract_or (basic_span< T, P, S > spn, T &fallback) noexcept -> T &
 Overload of extract_or for spans. Returns the first element,.
 
template<typename T , typename P , typename S , typename F >
static constexpr auto eagine::memory::extract_or (basic_span< T, P, S > spn, F &&fallback) -> std::enable_if_t< std::is_convertible_v< F, T >, T >
 Overload of extract_or for spans. Returns the first element,.
 

Variables

template<typename T >
constexpr bool eagine::memory::has_span_size_member_v
 Trait indicating if type T has x.size() member function.
 
template<typename T , typename E = anything>
constexpr bool eagine::memory::has_span_data_member_v
 Trait indicating if type T has x.size() member function.
 

Detailed Description

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt


Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).