visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114671 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
28c97e6ee1
commit
8d7a9557b7
@ -182,7 +182,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
// basic_stringbuf
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_stringbuf
|
||||
class _LIBCPP_VISIBLE basic_stringbuf
|
||||
: public basic_streambuf<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@ -525,7 +525,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
|
||||
// basic_istringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_istringstream
|
||||
class _LIBCPP_VISIBLE basic_istringstream
|
||||
: public basic_istream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@ -644,7 +644,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
// basic_ostringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_ostringstream
|
||||
class _LIBCPP_VISIBLE basic_ostringstream
|
||||
: public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@ -763,7 +763,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
// basic_stringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_stringstream
|
||||
class _LIBCPP_VISIBLE basic_stringstream
|
||||
: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
|
@ -92,7 +92,7 @@ bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
class stack
|
||||
class _LIBCPP_VISIBLE stack
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@ -105,56 +105,76 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack() : c() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const container_type& __c) : c(__c) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __s) : c(_STD::move(__s.c)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const container_type& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__c, __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const stack& __s, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__s.c, __a) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__c), __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __s, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__s.c), __a) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference top() {return c.back();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference top() const {return c.back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args> void emplace(_Args&&... __args)
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() {c.pop_back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(stack& __s)
|
||||
{
|
||||
using _STD::swap;
|
||||
@ -173,7 +193,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -181,7 +201,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -189,7 +209,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -197,7 +217,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -205,7 +225,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -213,7 +233,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -221,7 +241,7 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@ -229,7 +249,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Alloc>
|
||||
struct uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
@ -117,7 +117,7 @@ protected:
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_streambuf
|
||||
class _LIBCPP_VISIBLE basic_streambuf
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
|
@ -442,7 +442,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
// fpos
|
||||
|
||||
template <class _StateT>
|
||||
class fpos
|
||||
class _LIBCPP_VISIBLE fpos
|
||||
{
|
||||
private:
|
||||
_StateT __st_;
|
||||
@ -628,7 +628,7 @@ struct _LIBCPP_VISIBLE char_traits<char>
|
||||
// char_traits<wchar_t>
|
||||
|
||||
template <>
|
||||
struct char_traits<wchar_t>
|
||||
struct _LIBCPP_VISIBLE char_traits<wchar_t>
|
||||
{
|
||||
typedef wchar_t char_type;
|
||||
typedef wint_t int_type;
|
||||
@ -665,7 +665,7 @@ struct char_traits<wchar_t>
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct char_traits<char16_t>
|
||||
struct _LIBCPP_VISIBLE char_traits<char16_t>
|
||||
{
|
||||
typedef char16_t char_type;
|
||||
typedef uint_least16_t int_type;
|
||||
@ -771,7 +771,7 @@ char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
|
||||
}
|
||||
|
||||
template <>
|
||||
struct char_traits<char32_t>
|
||||
struct _LIBCPP_VISIBLE char_traits<char32_t>
|
||||
{
|
||||
typedef char32_t char_type;
|
||||
typedef uint_least32_t int_type;
|
||||
@ -1058,6 +1058,7 @@ public:
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
|
||||
basic_string& operator=(value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
|
||||
|
||||
#ifndef _LIBCPP_DEBUG
|
||||
@ -1092,6 +1093,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
|
||||
|
||||
void reserve(size_type res_arg = 0);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void shrink_to_fit() {reserve();}
|
||||
void clear();
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return size() == 0;}
|
||||
@ -1127,6 +1129,7 @@ public:
|
||||
basic_string&
|
||||
>::type
|
||||
append(_ForwardIterator __first, _ForwardIterator __last);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
|
||||
|
||||
void push_back(value_type __c);
|
||||
@ -1156,6 +1159,7 @@ public:
|
||||
basic_string&
|
||||
>::type
|
||||
assign(_ForwardIterator __first, _ForwardIterator __last);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
|
||||
|
||||
basic_string& insert(size_type __pos1, const basic_string& __str);
|
||||
@ -1180,6 +1184,7 @@ public:
|
||||
iterator
|
||||
>::type
|
||||
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, initializer_list<value_type> __il)
|
||||
{return insert(__pos, __il.begin(), __il.end());}
|
||||
|
||||
@ -1203,6 +1208,7 @@ public:
|
||||
basic_string&
|
||||
>::type
|
||||
replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(iterator __i1, iterator __i2, initializer_list<value_type> __il)
|
||||
{return replace(__i1, __i2, __il.begin(), __il.end());}
|
||||
|
||||
@ -3551,7 +3557,7 @@ template<class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::npos;
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
struct hash<basic_string<_CharT, _Traits, _Allocator> >
|
||||
struct _LIBCPP_VISIBLE hash<basic_string<_CharT, _Traits, _Allocator> >
|
||||
: public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
|
||||
{
|
||||
size_t
|
||||
|
@ -135,7 +135,7 @@ private:
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class strstreambuf
|
||||
class _LIBCPP_VISIBLE strstreambuf
|
||||
: public streambuf
|
||||
{
|
||||
public:
|
||||
@ -187,20 +187,25 @@ private:
|
||||
void __init(char* __gnext, streamsize __n, char* __pbeg);
|
||||
};
|
||||
|
||||
class istrstream
|
||||
class _LIBCPP_VISIBLE istrstream
|
||||
: public istream
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit istrstream(const char* __s)
|
||||
: istream(&__sb_), __sb_(__s, 0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit istrstream(char* __s)
|
||||
: istream(&__sb_), __sb_(__s, 0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(const char* __s, streamsize __n)
|
||||
: istream(&__sb_), __sb_(__s, __n) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(char* __s, streamsize __n)
|
||||
: istream(&__sb_), __sb_(__s, __n) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(istrstream&& __rhs)
|
||||
: istream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
@ -208,6 +213,7 @@ public:
|
||||
istream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream& operator=(istrstream&& __rhs)
|
||||
{
|
||||
istream::operator=(_STD::move(__rhs));
|
||||
@ -218,31 +224,37 @@ public:
|
||||
|
||||
virtual ~istrstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(istrstream& __rhs)
|
||||
{
|
||||
istream::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char *str() {return __sb_.str();}
|
||||
|
||||
private:
|
||||
strstreambuf __sb_;
|
||||
};
|
||||
|
||||
class ostrstream
|
||||
class _LIBCPP_VISIBLE ostrstream
|
||||
: public ostream
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream()
|
||||
: ostream(&__sb_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
|
||||
: ostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(ostrstream&& __rhs)
|
||||
: ostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
@ -250,6 +262,7 @@ public:
|
||||
ostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream& operator=(ostrstream&& __rhs)
|
||||
{
|
||||
ostream::operator=(_STD::move(__rhs));
|
||||
@ -260,22 +273,27 @@ public:
|
||||
|
||||
virtual ~ostrstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(ostrstream& __rhs)
|
||||
{
|
||||
ostream::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char* str() {return __sb_.str();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int pcount() const {return __sb_.pcount();}
|
||||
|
||||
private:
|
||||
strstreambuf __sb_; // exposition only
|
||||
};
|
||||
|
||||
class strstream
|
||||
class _LIBCPP_VISIBLE strstream
|
||||
: public iostream
|
||||
{
|
||||
public:
|
||||
@ -286,14 +304,17 @@ public:
|
||||
typedef char_traits<char>::off_type off_type;
|
||||
|
||||
// constructors/destructor
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream()
|
||||
: iostream(&__sb_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
|
||||
: iostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(strstream&& __rhs)
|
||||
: iostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
@ -301,6 +322,7 @@ public:
|
||||
iostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream& operator=(strstream&& __rhs)
|
||||
{
|
||||
iostream::operator=(_STD::move(__rhs));
|
||||
@ -311,6 +333,7 @@ public:
|
||||
|
||||
virtual ~strstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(strstream& __rhs)
|
||||
{
|
||||
iostream::swap(__rhs);
|
||||
@ -318,9 +341,13 @@ public:
|
||||
}
|
||||
|
||||
// Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int pcount() const {return __sb_.pcount();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char* str() {return __sb_.str();}
|
||||
|
||||
private:
|
||||
|
@ -229,12 +229,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// is_error_code_enum
|
||||
|
||||
template <class _Tp> struct is_error_code_enum
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum
|
||||
: public false_type {};
|
||||
|
||||
// is_error_condition_enum
|
||||
|
||||
template <class _Tp> struct is_error_condition_enum
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum
|
||||
: public false_type {};
|
||||
|
||||
// Some error codes are not present on all platforms, so we provide equivalents
|
||||
@ -342,15 +344,19 @@ enum _ {
|
||||
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
errc(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
template <> struct is_error_condition_enum<errc>
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
|
||||
: true_type { };
|
||||
|
||||
template <> struct is_error_condition_enum<errc::_>
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
|
||||
: true_type { };
|
||||
|
||||
class error_condition;
|
||||
@ -360,7 +366,7 @@ class error_code;
|
||||
|
||||
class __do_message;
|
||||
|
||||
class error_category
|
||||
class _LIBCPP_VISIBLE error_category
|
||||
{
|
||||
public:
|
||||
virtual ~error_category();
|
||||
@ -399,7 +405,7 @@ public:
|
||||
const error_category& generic_category();
|
||||
const error_category& system_category();
|
||||
|
||||
class error_condition
|
||||
class _LIBCPP_VISIBLE error_condition
|
||||
{
|
||||
int __val_;
|
||||
const error_category* __cat_;
|
||||
@ -469,7 +475,7 @@ operator<(const error_condition& __x, const error_condition& __y)
|
||||
|
||||
// error_code
|
||||
|
||||
class error_code
|
||||
class _LIBCPP_VISIBLE error_code
|
||||
{
|
||||
int __val_;
|
||||
const error_category* __cat_;
|
||||
@ -588,9 +594,10 @@ bool
|
||||
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}
|
||||
|
||||
template <>
|
||||
struct hash<error_code>
|
||||
struct _LIBCPP_VISIBLE hash<error_code>
|
||||
: public unary_function<error_code, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const error_code& __ec) const
|
||||
{
|
||||
return static_cast<size_t>(__ec.value());
|
||||
@ -599,7 +606,7 @@ struct hash<error_code>
|
||||
|
||||
// system_error
|
||||
|
||||
class system_error
|
||||
class _LIBCPP_VISIBLE system_error
|
||||
: public runtime_error
|
||||
{
|
||||
error_code __ec_;
|
||||
|
@ -118,8 +118,11 @@ public:
|
||||
__thread_specific_ptr();
|
||||
~__thread_specific_ptr();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer get() const {return static_cast<_Tp*>(pthread_getspecific(__key_));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator*() const {return *get();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return get();}
|
||||
pointer release();
|
||||
void reset(pointer __p = nullptr);
|
||||
@ -175,7 +178,7 @@ __thread_id get_id();
|
||||
|
||||
} // this_thread
|
||||
|
||||
class __thread_id
|
||||
class _LIBCPP_VISIBLE __thread_id
|
||||
{
|
||||
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
|
||||
// NULL is the no-thread value on Darwin. Someone needs to check
|
||||
@ -183,40 +186,50 @@ class __thread_id
|
||||
pthread_t __id_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id() : __id_(0) {}
|
||||
|
||||
friend bool operator==(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__thread_id __x, __thread_id __y)
|
||||
{return __x.__id_ == __y.__id_;}
|
||||
friend bool operator!=(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__thread_id __x, __thread_id __y)
|
||||
{return !(__x == __y);}
|
||||
friend bool operator< (__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator< (__thread_id __x, __thread_id __y)
|
||||
{return __x.__id_ < __y.__id_;}
|
||||
friend bool operator<=(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(__thread_id __x, __thread_id __y)
|
||||
{return !(__y < __x);}
|
||||
friend bool operator> (__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator> (__thread_id __x, __thread_id __y)
|
||||
{return __y < __x ;}
|
||||
friend bool operator>=(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(__thread_id __x, __thread_id __y)
|
||||
{return !(__x < __y);}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
|
||||
{return __os << __id.__id_;}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id(pthread_t __id) : __id_(__id) {}
|
||||
|
||||
friend __thread_id this_thread::get_id();
|
||||
friend class thread;
|
||||
friend class _LIBCPP_VISIBLE thread;
|
||||
};
|
||||
|
||||
template<class _Tp> struct hash;
|
||||
|
||||
template<>
|
||||
struct hash<__thread_id>
|
||||
struct _LIBCPP_VISIBLE hash<__thread_id>
|
||||
: public unary_function<__thread_id, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(__thread_id __v) const
|
||||
{
|
||||
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
|
||||
@ -227,7 +240,7 @@ struct hash<__thread_id>
|
||||
namespace this_thread
|
||||
{
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id
|
||||
get_id()
|
||||
{
|
||||
@ -236,7 +249,7 @@ get_id()
|
||||
|
||||
} // this_thread
|
||||
|
||||
class thread
|
||||
class _LIBCPP_VISIBLE thread
|
||||
{
|
||||
pthread_t __t_;
|
||||
|
||||
@ -251,6 +264,7 @@ public:
|
||||
typedef __thread_id id;
|
||||
typedef pthread_t native_handle_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread() : __t_(0) {}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _F, class ..._Args,
|
||||
@ -266,16 +280,21 @@ public:
|
||||
~thread();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
|
||||
thread& operator=(thread&& __t);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool joinable() const {return __t_ != 0;}
|
||||
void join();
|
||||
void detach();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
id get_id() const {return __t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return __t_;}
|
||||
|
||||
static unsigned hardware_concurrency();
|
||||
@ -345,7 +364,7 @@ thread::thread(_F __f)
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
thread&
|
||||
thread::operator=(thread&& __t)
|
||||
{
|
||||
@ -358,7 +377,7 @@ thread::operator=(thread&& __t)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __x, thread& __y) {__x.swap(__y);}
|
||||
|
||||
namespace this_thread
|
||||
@ -390,7 +409,7 @@ sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
}
|
||||
|
||||
template <class _Duration>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
|
||||
{
|
||||
@ -398,7 +417,7 @@ sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
|
||||
sleep_for(__t - monotonic_clock::now());
|
||||
}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void yield() {sched_yield();}
|
||||
|
||||
} // this_thread
|
||||
|
Loading…
Reference in New Issue
Block a user