Code Monkey home page Code Monkey logo

inplace_string's Introduction

Build Status Build status Coverage Status

inplace_string<N, CharT, Traits>

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<15>; // 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<5> too_small;
  too_small = "foobar"; // error: static_assert failed "basic_inplace_string: size exceeds maximum capacity"
}

Compatibility

inplace_string<N, CharT, Traits> 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

inplace_string's People

Contributors

david-grs avatar

Stargazers

Ray Manaloto avatar Calvin avatar Stoyan avatar Rahul Mundke avatar  avatar Oleksandr Gituliar avatar Charles Zu avatar Wayne Lu avatar  avatar Karim Ahmed avatar  avatar AIer avatar  avatar Savyasachi Singh avatar Niko Kaštelan avatar Ayman Eltemmsahy avatar  avatar  avatar Igor Nikonov avatar GAURAV avatar Keith Leonardo avatar  avatar Mikhail Mitkevich avatar  avatar Leon Kaiser avatar nightskycode avatar  avatar  avatar Aydın Özcan avatar Dendi Suhubdy avatar Marek Niepiekło avatar Leo Vasconcelos avatar Abner Kaizer avatar Mikhail Bautin avatar  avatar Peter Gaal avatar xiongjiajun avatar  avatar  avatar Alexander Jobling avatar Igisid avatar Castramet avatar Ivan Moskalev avatar Remo avatar Andrey avatar  avatar Anton Aŭtuška avatar  avatar Damien Bagnoud avatar vasya vasin avatar Dmitrii Sannikov avatar  avatar Stefano Cristiano avatar Albert Tavares de Almeida avatar Alexandre Larouche avatar kai avatar  avatar Helder Parracho avatar Rain avatar Manu Sánchez avatar Benjamin Porter avatar Ido Rosen avatar  avatar  avatar Dávid Bolvanský avatar Jonathan Poelen avatar Roal Zanazzi avatar  avatar Sergey Vaytsel avatar  avatar Alessandro Vergani avatar Anton Tsukanov avatar  avatar Jesse Talavera avatar Chloë Salzenberg avatar Dmitry Loginov avatar WasserEsser avatar Lorcán Mc Donagh avatar Marco Craveiro avatar wwrzal avatar Nayef Copty avatar toge avatar Dmitry Ledentsov avatar TalLancaster avatar Viktor Kirilov avatar Kris Jusiak avatar Bill Quith avatar Lars Viklund avatar Rob Parolin avatar Davide Faconti avatar Jeff Garrett avatar Adi Shavit avatar Arvid Gerstmann avatar

Watchers

Dmitry Loginov avatar Rahul Mundke avatar  avatar toge avatar James Cloos avatar Nayef Copty avatar Antony Peacock avatar TalLancaster avatar Remo avatar Michael Rayva avatar Shaul Fridman avatar  avatar yangdemin avatar  avatar Ray Manaloto avatar

inplace_string's Issues

C++17 ctor deduction guides

Isn't it possible to add template argument deduction guides to allow: inplace_string s = "meh"; without having to explicitly specify the length?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.