Skip to content

Instantly share code, notes, and snippets.

View xgcssch's full-sized avatar

Sönke Schau xgcssch

  • Hamburg, Germany
View GitHub Profile
#include "common.h"
#include <iostream>
#include <format>
#include <string>
#include <string_view>
#include <type_traits>
#include <nlohmann/json.hpp>
template<typename T>
concept ConvertibleToJson = requires(T a)

Keybase proof

I hereby claim:

  • I am xgcssch on github.
  • I am xgcssch (https://keybase.io/xgcssch) on keybase.
  • I have a public key ASA2Nvzotv1UFBWCHEl8e4bbYhhz8Ku5DnjsXygQpIjybwo

To claim this, I am signing this object:

@xgcssch
xgcssch / find_with_string_view.md
Last active November 8, 2019 15:58
C++ Use find() of STL Containers with an std::string_view argument (with C++14)

C++ Use find() of STL Containers with an std::string_view argument (with C++14)

Problem

You will receive an error, when trying to compile this code:

std::string_view sv("kljlkj");
std::set<std::string> sc;
auto x =sc.find(sv); => error: no matching member function for call to 'find'

Adding a comparer for std::string_view to the container doesn't help either: