Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::basic_string_view

      From cppreference.com
      <cpp‎ |experimental
       
       
       
       
      std::experimental::basic_string_view
       
      Merged into ISO C++ The functionality described on this page was merged into the mainline ISO C++ standard as of 3/2016, seestd::basic_string_view(since C++17)
      template<

         class CharT,
         class Traits=std::char_traits<CharT>

      >class basic_string_view;
      (library fundamentals TS)

      The class templatebasic_string_view describes an object that can refer to a constant contiguous sequence ofchar-like objects with the first element of the sequence at position zero.

      A typical implementation holds only two members: a pointer to constantCharT and a size.

      Several typedefs for common character types are provided:

      Type Definition
      std::experimental::string_viewstd::experimental::basic_string_view<char>
      std::experimental::wstring_viewstd::experimental::basic_string_view<wchar_t>
      std::experimental::u16string_viewstd::experimental::basic_string_view<char16_t>
      std::experimental::u32string_viewstd::experimental::basic_string_view<char32_t>

      Contents

      [edit]Template parameters

      CharT - character type
      Traits - traits class specifying the operations on the character type

      [edit]Member types

      Member type Definition
      traits_typeTraits
      value_typeCharT
      pointerCharT*
      const_pointerconst CharT*
      referenceCharT&
      const_referenceconst CharT&
      const_iterator implementation-definedLegacyRandomAccessIterator
      iteratorconst_iterator
      reverse_iteratorconst_reverse_iterator
      const_reverse_iteratorstd::reverse_iterator<const_iterator>
      size_typestd::size_t
      difference_typestd::ptrdiff_t

      Note:iterator andconst_iterator are the same type because string views are views into constant character sequences.

      [edit]Member functions

      constructs abasic_string_view
      (public member function)[edit]
      assigns a view
      (public member function)[edit]
      Iterators
      returns an iterator to the beginning
      (public member function)[edit]
      returns an iterator to the end
      (public member function)[edit]
      returns a reverse iterator to the beginning
      (public member function)[edit]
      returns a reverse iterator to the end
      (public member function)[edit]
      Element access
      access specified character
      (public member function)[edit]
      access specified character with bounds checking
      (public member function)[edit]
      accesses the first character
      (public member function)[edit]
      accesses the last character
      (public member function)[edit]
      returns a pointer to the first character of a view
      (public member function)[edit]
      Capacity
      returns the number of characters
      (public member function)[edit]
      returns the maximum number of characters
      (public member function)[edit]
      checks whether the view is empty
      (public member function)[edit]
      Modifiers
      shrinks the view by moving its start forward
      (public member function)[edit]
      shrinks the view by moving its end backward
      (public member function)[edit]
      swaps the contents
      (public member function)[edit]
      Operations
      creates a string from the view
      (public member function)[edit]
      copies characters
      (public member function)[edit]
      returns a substring
      (public member function)[edit]
      compares two views
      (public member function)[edit]
      find characters in the view
      (public member function)[edit]
      find the last occurrence of a substring
      (public member function)[edit]
      find first occurrence of characters
      (public member function)[edit]
      find last occurrence of characters
      (public member function)[edit]
      find first absence of characters
      (public member function)[edit]
      find last absence of characters
      (public member function)[edit]

      Constants

      [static]
      special value. The exact meaning depends on the context
      (public static member constant)[edit]

      [edit]Non-member functions

      lexicographically compares two views
      (function template)[edit]
      Input/output
      performs stream output on views
      (function template)[edit]

      [edit]Helper classes

      hash support for views
      (class template specialization)[edit]

      [edit]Feature test macros

      __cpp_lib_experimental_string_view
      a value of at least201411 indicates that basic_string_view template is supported
      (macro constant)
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/basic_string_view&oldid=163664"

      [8]ページ先頭

      ©2009-2025 Movatter.jp