GCC Middle and Back End API Reference
char_span Class Reference

#include <input.h>

Public Member Functions

 char_span (const char *ptr, size_t n_elts)
 
 operator bool () const
 
size_t length () const
 
const char * get_buffer () const
 
char operator[] (int idx) const
 
char_span subspan (int offset, int n_elts) const
 
char * xstrdup () const
 

Private Attributes

const char * m_ptr
 
size_t m_n_elts
 

Detailed Description

A class capturing the bounds of a buffer, to allow for run-time
bounds-checking in a checked build.   

Constructor & Destructor Documentation

◆ char_span()

char_span::char_span ( const char * ptr,
size_t n_elts )
inline

Referenced by subspan().

Member Function Documentation

◆ get_buffer()

◆ length()

◆ operator bool()

char_span::operator bool ( ) const
inline

References m_ptr.

◆ operator[]()

char char_span::operator[] ( int idx) const
inline

References gcc_assert, m_n_elts, and m_ptr.

◆ subspan()

char_span char_span::subspan ( int offset,
int n_elts ) const
inline

◆ xstrdup()

char * char_span::xstrdup ( ) const
inline

Field Documentation

◆ m_n_elts

size_t char_span::m_n_elts
private

Referenced by length(), operator[](), subspan(), and xstrdup().

◆ m_ptr

const char* char_span::m_ptr
private

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