Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

inplace_string

> 编程语言
Open source

C++17 inplace_string implementation

99 stars0 likes3 views
WebsiteGitHub

About

C++17 inplace_string implementation

inplace_string

An alternative to std::string with inplace storage. STL compliant, can be used as a full replacement of C++17's std::string.

Example

{
  using Name = inplace_string; // 16 bytes on stack, size included
  Name name = "foo"; 

  auto it = name.find("r");
  assert(it == Name::npos);

  name += "bar";
  
  std::string str(name); // implicit std::string_view construction

  ....
}

{
  inplace_string too_small;
  too_small = "foobar"; // error: static_assert failed "basic_inplace_string: size exceeds maximum capacity"
}

Compatibility

inplace_string implements C++17's std::string interface, plus:

  • max_size() and capacity() are constexpr
  • inplace_string can be constructed from const CharT(&)[M]), allowing a compile-time error if the input exceeds the maximum capacity

Supports Clang >= 3.4, GCC >= 5, VS >= 2017

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言