Cuda battery library
Loading...
Searching...
No Matches
battery::string< Allocator > Class Template Reference

#include <string.hpp>

Public Types

using this_type = string<Allocator>
 
using allocator_type = Allocator
 
using value_type = char
 

Public Member Functions

CUDA string (size_t n, const allocator_type &alloc=allocator_type())
 
CUDA string (const allocator_type &alloc=allocator_type())
 
CUDA string (const char *raw_string, const allocator_type &alloc=allocator_type())
 
template<class Allocator2 >
CUDA string (const string< Allocator2 > &other, const allocator_type &alloc=allocator_type())
 
CUDA string (const string< allocator_type > &other)
 
 string (string< allocator_type > &&other)=default
 
CUDA string< allocator_type > & operator= (string< allocator_type > other)
 
 string (const std::string &other, const allocator_type &alloc=allocator_type())
 
CUDA allocator_type get_allocator () const
 
CUDA size_t size () const
 
CUDA char & operator[] (size_t i)
 
CUDA const char & operator[] (size_t i) const
 
CUDA char * data ()
 
CUDA const char * data () const
 
CUDA NI void print () const
 
CUDA NI bool ends_with (const char *suffix) const
 

Static Public Member Functions

template<class IntegerType >
CUDA static NI this_type from_int (IntegerType x, const allocator_type &alloc=allocator_type())
 

Friends

template<class Alloc2 >
class string
 
template<class Alloc1 , class Alloc2 >
CUDA friend bool operator== (const string< Alloc1 > &lhs, const string< Alloc2 > &rhs)
 

Detailed Description

template<class Allocator = standard_allocator>
class battery::string< Allocator >

string represents a fixed sized array of characters based on vector<char>. All strings are null-terminated.

Member Typedef Documentation

◆ this_type

template<class Allocator = standard_allocator>
using battery::string< Allocator >::this_type = string<Allocator>

◆ allocator_type

template<class Allocator = standard_allocator>
using battery::string< Allocator >::allocator_type = Allocator

◆ value_type

template<class Allocator = standard_allocator>
using battery::string< Allocator >::value_type = char

Constructor & Destructor Documentation

◆ string() [1/7]

template<class Allocator = standard_allocator>
CUDA battery::string< Allocator >::string ( size_t n,
const allocator_type & alloc = allocator_type() )
inline

Allocate a string of size n using allocator.

◆ string() [2/7]

template<class Allocator = standard_allocator>
CUDA battery::string< Allocator >::string ( const allocator_type & alloc = allocator_type())
inline

◆ string() [3/7]

template<class Allocator = standard_allocator>
CUDA battery::string< Allocator >::string ( const char * raw_string,
const allocator_type & alloc = allocator_type() )
inline

Allocate a string from raw_string using allocator.

◆ string() [4/7]

template<class Allocator = standard_allocator>
template<class Allocator2 >
CUDA battery::string< Allocator >::string ( const string< Allocator2 > & other,
const allocator_type & alloc = allocator_type() )
inline

Copy constructor with an allocator.

◆ string() [5/7]

template<class Allocator = standard_allocator>
CUDA battery::string< Allocator >::string ( const string< allocator_type > & other)
inline

Redefine the copy constructor to be sure it calls a constructor with an allocator.

◆ string() [6/7]

template<class Allocator = standard_allocator>
battery::string< Allocator >::string ( string< allocator_type > && other)
default

◆ string() [7/7]

template<class Allocator = standard_allocator>
battery::string< Allocator >::string ( const std::string< Allocator > & other,
const allocator_type & alloc = allocator_type() )
inline

Member Function Documentation

◆ operator=()

template<class Allocator = standard_allocator>
CUDA string< allocator_type > & battery::string< Allocator >::operator= ( string< allocator_type > other)
inline

◆ get_allocator()

template<class Allocator = standard_allocator>
CUDA allocator_type battery::string< Allocator >::get_allocator ( ) const
inline

◆ size()

template<class Allocator = standard_allocator>
CUDA size_t battery::string< Allocator >::size ( ) const
inline

◆ operator[]() [1/2]

template<class Allocator = standard_allocator>
CUDA char & battery::string< Allocator >::operator[] ( size_t i)
inline

◆ operator[]() [2/2]

template<class Allocator = standard_allocator>
CUDA const char & battery::string< Allocator >::operator[] ( size_t i) const
inline

◆ data() [1/2]

template<class Allocator = standard_allocator>
CUDA char * battery::string< Allocator >::data ( )
inline

◆ data() [2/2]

template<class Allocator = standard_allocator>
CUDA const char * battery::string< Allocator >::data ( ) const
inline

◆ print()

template<class Allocator = standard_allocator>
CUDA NI void battery::string< Allocator >::print ( ) const
inline

◆ ends_with()

template<class Allocator = standard_allocator>
CUDA NI bool battery::string< Allocator >::ends_with ( const char * suffix) const
inline

◆ from_int()

template<class Allocator = standard_allocator>
template<class IntegerType >
CUDA static NI this_type battery::string< Allocator >::from_int ( IntegerType x,
const allocator_type & alloc = allocator_type() )
inlinestatic

Friends And Related Symbol Documentation

◆ string

template<class Allocator = standard_allocator>
template<class Alloc2 >
friend class string
friend

◆ operator==

template<class Allocator = standard_allocator>
template<class Alloc1 , class Alloc2 >
CUDA friend bool operator== ( const string< Alloc1 > & lhs,
const string< Alloc2 > & rhs )
friend

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