22 lines
464 B
C++
22 lines
464 B
C++
#include "mtl/string_view.hpp"
|
|
|
|
#include "mtl/string.hpp"
|
|
|
|
namespace mtl {
|
|
|
|
string_view::string_view(const istring& str)
|
|
: m_str(str.c_str()), m_size(str.size()) {}
|
|
string_view::string_view(const istring& str, size_t size)
|
|
: m_str(str.c_str()), m_size(size) {}
|
|
|
|
size_t string_view::copy(char* dest, size_t count, size_t pos) const {
|
|
if (count == npos) {
|
|
count = m_size - pos;
|
|
}
|
|
|
|
mtl_hybridcpy(dest, m_str + pos, count);
|
|
return count;
|
|
}
|
|
|
|
} // namespace mtl
|