#ifndef _LIBCPP_REFSTRING_H
#define _LIBCPP_REFSTRING_H
#include "atomic_support.h"
#include <__config>
#include <cstddef>
#include <cstring>
#include <stdexcept>
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
#define _LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE
# include <dlfcn.h>
# include <mach-o/dyld.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __refstring_imp {
namespace {
count_t;
struct _Rep_base { … };
inline _Rep_base* rep_from_data(const char* data_) noexcept { … }
inline char* data_from_rep(_Rep_base* rep) noexcept { … }
#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
inline const char* compute_gcc_empty_string_storage() noexcept {
void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD);
if (handle == nullptr)
return nullptr;
void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE");
if (sym == nullptr)
return nullptr;
return data_from_rep(reinterpret_cast<_Rep_base*>(sym));
}
inline const char* get_gcc_empty_string_storage() noexcept {
static const char* p = compute_gcc_empty_string_storage();
return p;
}
#endif
}
}
usingnamespace__refstring_imp;
inline __libcpp_refstring::__libcpp_refstring(const char* msg) { … }
inline __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring& s) noexcept : … { … }
inline __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) noexcept { … }
inline __libcpp_refstring::~__libcpp_refstring() { … }
inline bool __libcpp_refstring::__uses_refcount() const { … }
_LIBCPP_END_NAMESPACE_STD
#endif