Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class template basic_string

Boost , Chapter 1. Boost.Compute , Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template basic_string

boost::compute::basic_string — A template for a dynamically-sized character sequence.

Synopsis

// In header: <boost/compute/container/basic_string.hpp>
template<typename CharT, typename Traits = std::char_traits<CharT> > 
class basic_string {
public:
  // types
  typedef Traits                                                    traits_type;           
  typedef Traits::char_type                                         value_type;            
  typedef size_t                                                    size_type;             
  typedef ::boost::compute::vector< CharT >::reference              reference;             
  typedef ::boost::compute::vector< CharT >::const_reference        const_reference;       
  typedef ::boost::compute::vector< CharT >::iterator               iterator;              
  typedef ::boost::compute::vector< CharT >::const_iterator         const_iterator;        
  typedef ::boost::compute::vector< CharT >::reverse_iterator       reverse_iterator;      
  typedef ::boost::compute::vector< CharT >::const_reverse_iterator const_reverse_iterator;
  // construct/copy/destruct
  basic_string();
  basic_string(size_type, CharT);
  basic_string(const basic_string &, size_type, size_type = npos);
  basic_string(const char *, size_type);
  basic_string(const char *);
  template<typename InputIterator> basic_string(InputIterator, InputIterator);
  basic_string(const basic_string< CharT, Traits > &);
  basic_string< CharT, Traits > & 
  operator=(const basic_string< CharT, Traits > &);
  ~basic_string();
  // public member functions
  reference at(size_type);
  const_reference at(size_type) const;
  reference operator[](size_type);
  const_reference operator[](size_type) const;
  reference front();
  const_reference front() const;
  reference back();
  const_reference back() const;
  iterator begin();
  const_iterator begin() const;
  const_iterator cbegin() const;
  iterator end();
  const_iterator end() const;
  const_iterator cend() const;
  reverse_iterator rbegin();
  const_reverse_iterator rbegin() const;
  const_reverse_iterator crbegin() const;
  reverse_iterator rend();
  const_reverse_iterator rend() const;
  const_reverse_iterator crend() const;
  bool empty() const;
  size_type size() const;
  size_type length() const;
  size_type max_size() const;
  void reserve(size_type);
  size_type capacity() const;
  void shrink_to_fit();
  void clear();
  void swap(basic_string< CharT, Traits > &);
  basic_string< CharT, Traits > substr(size_type = 0, size_type = npos) const;
  size_type find(CharT, size_type = 0) const;
  size_type find(basic_string &, size_type = 0) const;
  size_type find(const char *, size_type = 0) const;
  // public data members
  static const size_type npos;
};

Description

Класс<basic_string>предоставляет общий шаблон для динамически размерной последовательности символов. Чаще всего это используется через<string>typedef (для<basic_string<char>>).

Например, для создания строки на устройстве с ее содержимым, скопированным с C-струны на хосте:

boost::compute::string str("hello, world!");

См. также:

vector

basic_string public construct/copy/destruct

  1. <
    basic_string();
    >
  2. <
    basic_string(size_typecount,CharTch);
    >
  3. <
    basic_string(constbasic_string&other,size_typepos,
                size_typecount=npos);
    >
  4. <
    basic_string(constchar*s,size_typecount);
    >
  5. <
    basic_string(constchar*s);
    >
  6. <
    template<typenameInputIterator>
     basic_string(InputIteratorfirst,InputIteratorlast);
    >
  7. <
    basic_string(constbasic_string<CharT,Traits>&other);
    >
  8. <
    basic_string<CharT,Traits>&
    operator=(constbasic_string<CharT,Traits>&other);
    >
  9. <
    ~basic_string();
    >

basic_string public member functions

  1. <
    referenceat(size_typepos);
    >
  2. <
    const_referenceat(size_typepos)const;
    >
  3. <
    referenceoperator[](size_typepos);
    >
  4. <
    const_referenceoperator[](size_typepos)const;
    >
  5. <
    referencefront();
    >
  6. <
    const_referencefront()const;
    >
  7. <
    referenceback();
    >
  8. <
    const_referenceback()const;
    >
  9. <
    iteratorbegin();
    >
  10. <
    const_iteratorbegin()const;
    >
  11. <
    const_iteratorcbegin()const;
    >
  12. <
    iteratorend();
    >
  13. <
    const_iteratorend()const;
    >
  14. <
    const_iteratorcend()const;
    >
  15. <
    reverse_iteratorrbegin();
    >
  16. <
    const_reverse_iteratorrbegin()const;
    >
  17. <
    const_reverse_iteratorcrbegin()const;
    >
  18. <
    reverse_iteratorrend();
    >
  19. <
    const_reverse_iteratorrend()const;
    >
  20. <
    const_reverse_iteratorcrend()const;
    >
  21. <
    boolempty()const;
    >
  22. <
    size_typesize()const;
    >
  23. <
    size_typelength()const;
    >
  24. <
    size_typemax_size()const;
    >
  25. <
    voidreserve(size_typesize);
    >
  26. <
    size_typecapacity()const;
    >
  27. <
    voidshrink_to_fit();
    >
  28. <
    voidclear();
    >
  29. <
    voidswap(basic_string<CharT,Traits>&other);
    >
  30. <
    basic_string<CharT,Traits>
    substr(size_typepos=0,size_typecount=npos)const;
    >
  31. <
    size_typefind(CharTch,size_typepos=0)const;
    >Найден первый персонаж<ch>.
  32. <
    size_typefind(basic_string&str,size_typepos=0)const;
    >Найдет первую подстроку, равную<str>.
  33. size_typefind(constchar*s,size_typepos=0)const;

    Находит первую подстроку, равную строке символа, указаннойs. Длина струны определяется первым нулевым символом.

    Например, следующий код

    возвращает 5 в качестве позиции.


PrevUpHomeNext

Статья Class template basic_string раздела Chapter 1. Boost.Compute Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 22:37:25/0.0097160339355469/1