Skip to content

C++14 compatible header-only std::string_view implementation

License

Notifications You must be signed in to change notification settings

borailgar/lstring_view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lstring_view

C++14 compatible header-only std::string_view implementation

  • Compile time evaluation:
  using namespace lambda::sv_literals;

  constexpr auto ex0 = "ExampleSV"_sv;
  static_assert(ex0.size() > 1, "");

  constexpr auto ex1 = "Example2SV"_sv;
  static_assert(ex1.size() > 1, "");
  • Extended for some of C++ 20 std::string_view features :

    • *starts_with(const CharT),
    • *ends_with(const CharT)
   constexpr auto uri = "http://example.com"_sv;
   /*constexpr */ auto res = uri.starts_with("http");

   if (uri.starts_with("http"))
   {
       // ...
   }
   else{}

TODO :

  • unit-tests!

Releases

No releases published

Packages

No packages published

Languages