lokinet/llarp/util/string_view.hpp

30 lines
526 B
C++
Raw Normal View History

2018-11-01 12:47:14 +00:00
#ifndef LLARP_STRING_VIEW_HPP
#define LLARP_STRING_VIEW_HPP
#if __cplusplus >= 201703L
#include <string_view>
#include <string>
namespace llarp
{
using string_view = std::string_view;
2018-11-01 12:47:14 +00:00
static std::string
string_view_string(const string_view& v)
{
return std::string(v.data(), v.size());
}
} // namespace llarp
#else
#include <string>
namespace llarp
{
using string_view = std::string;
2018-11-01 12:47:14 +00:00
static std::string
string_view_string(const string_view& v)
{
return v;
};
} // namespace llarp
#endif
#endif