OpenTTD Source: span< T > Class Template Reference

OpenTTD Source 12.2

Public Types | Public Member Functions | Data Fields | Private Attributes
span< T > Class Template Reference

A trimmed down version of what std::span will be in C++20. More...

`#include <span_type.hpp>`

## Public Types
typedef T | element_type
typedef std::remove_cv< T >::type | value_type
typedef T & | reference
typedef T * | pointer
typedef pointer | iterator
typedef const_pointer | const_iterator
typedef size_t | size_type
typedef std::ptrdiff_t | difference_type

## Public Member Functions
constexpr | span (pointer data_in, size_t size_in)
template<class Container , typename std::enable_if<(is_compatible_container< Container, element_type >::value), int >::type = 0>
constexpr | span (Container &list) noexcept
template<class Container , typename std::enable_if<(std::is_const< element_type >::value &&is_compatible_container< Container, element_type >::value), int >::type = 0>
constexpr | span (const Container &list) noexcept
constexpr size_t | size () const noexcept
constexpr std::ptrdiff_t | ssize () const noexcept
constexpr bool | empty () const noexcept
constexpr iterator | begin () const noexcept
constexpr iterator | end () const noexcept
constexpr const_iterator | cbegin () const noexcept
constexpr const_iterator | cend () const noexcept

## Data Fields
const typedef T & | const_reference
const typedef T * | const_pointer

## Private Attributes
pointer | first
pointer | last

## Detailed Description

### template<class T>
class span< T >

A trimmed down version of what std::span will be in C++20.

It is fully forwards compatible, so if this codebase switches to C++20, all "span" instances can be replaced by "std::span" without loss of functionality.

Currently it only supports basic functionality:

- size() and friends
- begin() and friends

It is meant to simplify function parameters, where we only want to walk a continuous list.

Definition at line 60 of file span_type.hpp.

The documentation for this class was generated from the following file:

- src/core/span_type.hpp