Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# core.stdcpp.string

D header file for interaction with C++ std::string.
License:
Distributed under the Boost Software License 1.0. (See accompanying file LICENSE)
Authors:
Guillaume Chatelet Manu Evans

Source core/stdcpp/string.d

enum DefaultConstruct `Default`;
  Constructor argument for default construction
struct `char_traits`(CharT);
  Character traits classes specify character properties and provide specific semantics for certain operations on characters and sequences of characters.
struct `basic_string`(T, Traits = char_traits!T, Alloc = allocator!T);
  D language counterpart to C++ std::basic_string.
  C++ reference:
  enum size_type `npos`;
  alias `size_type` = size_t;
  alias `difference_type` = ptrdiff_t;
  alias `value_type` = T;
  alias `traits_type` = Traits;
  alias `allocator_type` = Alloc;
  alias `pointer` = value_type*;
  alias `const_pointer` = const(value_type)*;
  alias `toString` = as_array;
  this();
    MSVC allocates on default initialisation in debug, which can't be modelled by D struct
  alias `length` = size;
  alias `opDollar` = length;
  const nothrow @safe bool `empty`();
  const pure nothrow @nogc @safe size_t[2] `opSlice`(size_t dim : 0)(size_t `start`, size_t `end`);
  inout pure nothrow @nogc ref @safe inout(T) `opIndex`(size_t `index`);
  inout pure nothrow @nogc @safe inout(T)[] `opIndex`(size_t[2] `slice`);
  inout pure nothrow @nogc @safe inout(T)[] `opIndex`();
  void `clear`();
  @trusted void `resize`(size_type `n`, T `c` = T(0));
  inout nothrow ref @safe inout(T) `front`();
  inout nothrow ref @safe inout(T) `back`();
  const nothrow @safe const(T)* `c_str`();
  ref basic_string `opAssign`()(auto ref basic_string `str`);
  ref basic_string `opAssign`(const(T)[] `str`);
  ref basic_string `opAssign`(T `c`);
  ref basic_string `opIndexAssign`(T `c`, size_t `index`);
  ref basic_string `opIndexAssign`(T `c`, size_t[2] `slice`);
  ref basic_string `opIndexAssign`(const(T)[] `str`, size_t[2] `slice`);
  ref basic_string `opIndexAssign`(T `c`);
  ref basic_string `opIndexAssign`(const(T)[] `str`);
  ref basic_string `opIndexOpAssign`(string op)(T `c`, size_t `index`);
  ref basic_string `opIndexOpAssign`(string op)(T `c`, size_t[2] `slice`);
  ref basic_string `opIndexOpAssign`(string op)(const(T)[] `str`, size_t[2] `slice`);
  ref basic_string `opIndexOpAssign`(string op)(T `c`);
  ref basic_string `opIndexOpAssign`(string op)(const(T)[] `str`);
  ref basic_string `append`(T `c`);
  ref basic_string `opOpAssign`(string op : "~")(const(T)[] `str`);
  ref basic_string `opOpAssign`(string op : "~")(T `c`);
  ref basic_string `erase`(size_type `pos` = 0);
  ref basic_string `erase`(size_type `pos`, size_type `len`);
  @trusted void `push_back`(T `c`);
  void `pop_back`();
  this(DefaultConstruct);
  this(const(T)[] `str`);
  this(const(T)[] `str`, ref const(allocator_type) `al`);
  inout ref inout(Alloc) `get_allocator`();
  const nothrow @safe size_type `max_size`();
  const nothrow @safe size_type `size`();
  const nothrow @safe size_type `capacity`();
  inout @safe inout(T)* `data`();
  inout nothrow @trusted inout(T)[] `as_array`();
  inout nothrow ref @trusted inout(T) `at`(size_type `i`);
  ref basic_string `assign`(const(T)[] `str`);
  ref basic_string `append`(const(T)[] `str`);

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Fri Apr 17 19:10:57 2020