forked from KolibriOS/kolibrios
sdk: build libsupc++ from libstdc++ source
git-svn-id: svn://kolibrios.org@5134 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
320
contrib/sdk/sources/libstdc++-v3/include/tr2/bool_set
Normal file
320
contrib/sdk/sources/libstdc++-v3/include/tr2/bool_set
Normal file
@@ -0,0 +1,320 @@
|
||||
// TR2 <bool_set> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file tr2/bool_set
|
||||
* This is a TR2 C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_TR2_BOOL_SET
|
||||
#define _GLIBCXX_TR2_BOOL_SET 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <typeinfo>
|
||||
#include <iostream>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace tr2
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* bool_set
|
||||
*
|
||||
* See N2136, Bool_set: multi-valued logic
|
||||
* by Herv<72> Br<42>nnimann, Guillaume Melquiond, Sylvain Pion.
|
||||
*
|
||||
* The implicit conversion to bool is slippery! I may use the new
|
||||
* explicit conversion. This has been specialized in the language
|
||||
* so that in contexts requiring a bool the conversion happens
|
||||
* implicitly. Thus most objections should be eliminated.
|
||||
*/
|
||||
class bool_set
|
||||
{
|
||||
public:
|
||||
|
||||
/// Default constructor.
|
||||
constexpr bool_set() : _M_b(_S_false) { }
|
||||
|
||||
/// Constructor from bool.
|
||||
constexpr bool_set(bool __t) : _M_b(_Bool_set_val(__t)) { }
|
||||
|
||||
// I'm not sure about this.
|
||||
bool contains(bool_set __b) const
|
||||
{ return this->is_singleton() && this->equals(__b); }
|
||||
|
||||
/// Return true if states are equal.
|
||||
bool equals(bool_set __b) const
|
||||
{ return __b._M_b == _M_b; }
|
||||
|
||||
/// Return true if this is empty.
|
||||
bool is_emptyset() const
|
||||
{ return _M_b == _S_empty; }
|
||||
|
||||
/// Return true if this is indeterminate.
|
||||
bool is_indeterminate() const
|
||||
{ return _M_b == _S_indet; }
|
||||
|
||||
/// Return true if this is false or true (normal boolean).
|
||||
bool is_singleton() const
|
||||
{ return _M_b == _S_false || _M_b == _S_true_; }
|
||||
|
||||
/// Conversion to bool.
|
||||
//explicit
|
||||
operator bool() const
|
||||
{
|
||||
if (! is_singleton())
|
||||
throw std::bad_cast();
|
||||
return _M_b;
|
||||
}
|
||||
|
||||
///
|
||||
static bool_set indeterminate()
|
||||
{
|
||||
bool_set __b;
|
||||
__b._M_b = _S_indet;
|
||||
return __b;
|
||||
}
|
||||
|
||||
///
|
||||
static bool_set emptyset()
|
||||
{
|
||||
bool_set __b;
|
||||
__b._M_b = _S_empty;
|
||||
return __b;
|
||||
}
|
||||
|
||||
friend bool_set
|
||||
operator!(bool_set __b)
|
||||
{ return __b._M_not(); }
|
||||
|
||||
friend bool_set
|
||||
operator^(bool_set __s, bool_set __t)
|
||||
{ return __s._M_xor(__t); }
|
||||
|
||||
friend bool_set
|
||||
operator|(bool_set __s, bool_set __t)
|
||||
{ return __s._M_or(__t); }
|
||||
|
||||
friend bool_set
|
||||
operator&(bool_set __s, bool_set __t)
|
||||
{ return __s._M_and(__t); }
|
||||
|
||||
friend bool_set
|
||||
operator==(bool_set __s, bool_set __t)
|
||||
{ return __s._M_eq(__t); }
|
||||
|
||||
|
||||
// These overloads replace the facet additions in the paper!
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>&
|
||||
operator<<(std::basic_ostream<CharT, Traits>& __out, bool_set __b)
|
||||
{
|
||||
int __a = __b._M_b;
|
||||
__out << __a;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_istream<CharT, Traits>&
|
||||
operator>>(std::basic_istream<CharT, Traits>& __in, bool_set& __b)
|
||||
{
|
||||
long __c;
|
||||
__in >> __c;
|
||||
if (__c >= _S_false && __c < _S_empty)
|
||||
__b._M_b = static_cast<_Bool_set_val>(__c);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
enum _Bool_set_val: unsigned char
|
||||
{
|
||||
_S_false = 0,
|
||||
_S_true_ = 1,
|
||||
_S_indet = 2,
|
||||
_S_empty = 3
|
||||
};
|
||||
|
||||
/// Bool set state.
|
||||
_Bool_set_val _M_b;
|
||||
|
||||
///
|
||||
bool_set(_Bool_set_val __c) : _M_b(__c) { }
|
||||
|
||||
///
|
||||
bool_set _M_not() const
|
||||
{ return _S_not[this->_M_b]; }
|
||||
|
||||
///
|
||||
bool_set _M_xor(bool_set __b) const
|
||||
{ return _S_xor[this->_M_b][__b._M_b]; }
|
||||
|
||||
///
|
||||
bool_set _M_or(bool_set __b) const
|
||||
{ return _S_or[this->_M_b][__b._M_b]; }
|
||||
|
||||
///
|
||||
bool_set _M_and(bool_set __b) const
|
||||
{ return _S_and[this->_M_b][__b._M_b]; }
|
||||
|
||||
///
|
||||
bool_set _M_eq(bool_set __b) const
|
||||
{ return _S_eq[this->_M_b][__b._M_b]; }
|
||||
|
||||
///
|
||||
static _Bool_set_val _S_not[4];
|
||||
|
||||
///
|
||||
static _Bool_set_val _S_xor[4][4];
|
||||
|
||||
///
|
||||
static _Bool_set_val _S_or[4][4];
|
||||
|
||||
///
|
||||
static _Bool_set_val _S_and[4][4];
|
||||
|
||||
///
|
||||
static _Bool_set_val _S_eq[4][4];
|
||||
};
|
||||
|
||||
// 20.2.3.2 bool_set values
|
||||
|
||||
inline bool
|
||||
contains(bool_set __s, bool_set __t)
|
||||
{ return __s.contains(__t); }
|
||||
|
||||
inline bool
|
||||
equals(bool_set __s, bool_set __t)
|
||||
{ return __s.equals(__t); }
|
||||
|
||||
inline bool
|
||||
is_emptyset(bool_set __b)
|
||||
{ return __b.is_emptyset(); }
|
||||
|
||||
inline bool
|
||||
is_indeterminate(bool_set __b)
|
||||
{ return __b.is_indeterminate(); }
|
||||
|
||||
inline bool
|
||||
is_singleton(bool_set __b)
|
||||
{ return __b.is_singleton(); }
|
||||
|
||||
inline bool
|
||||
certainly(bool_set __b)
|
||||
{ return ! __b.contains(false); }
|
||||
|
||||
inline bool
|
||||
possibly(bool_set __b)
|
||||
{ return __b.contains(true); }
|
||||
|
||||
|
||||
// 20.2.3.3 bool_set set operations
|
||||
|
||||
inline bool_set
|
||||
set_union(bool __s, bool_set __t)
|
||||
{ return bool_set(__s) | __t; }
|
||||
|
||||
inline bool_set
|
||||
set_union(bool_set __s, bool __t)
|
||||
{ return __s | bool_set(__t); }
|
||||
|
||||
inline bool_set
|
||||
set_union(bool_set __s, bool_set __t)
|
||||
{ return __s | __t; }
|
||||
|
||||
inline bool_set
|
||||
set_intersection(bool __s, bool_set __t)
|
||||
{ return bool_set(__s) & __t; }
|
||||
|
||||
inline bool_set
|
||||
set_intersection(bool_set __s, bool __t)
|
||||
{ return __s & bool_set(__t); }
|
||||
|
||||
inline bool_set
|
||||
set_intersection(bool_set __s, bool_set __t)
|
||||
{ return __s & __t; }
|
||||
|
||||
inline bool_set
|
||||
set_complement(bool_set __b)
|
||||
{ return ! __b; }
|
||||
|
||||
|
||||
// 20.2.3.4 bool_set logical operators
|
||||
|
||||
inline bool_set
|
||||
operator^(bool __s, bool_set __t)
|
||||
{ return bool_set(__s) ^ __t; }
|
||||
|
||||
inline bool_set
|
||||
operator^(bool_set __s, bool __t)
|
||||
{ return __s ^ bool_set(__t); }
|
||||
|
||||
inline bool_set
|
||||
operator|(bool __s, bool_set __t)
|
||||
{ return bool_set(__s) | __t; }
|
||||
|
||||
inline bool_set
|
||||
operator|(bool_set __s, bool __t)
|
||||
{ return __s | bool_set(__t); }
|
||||
|
||||
inline bool_set
|
||||
operator&(bool __s, bool_set __t)
|
||||
{ return bool_set(__s) & __t; }
|
||||
|
||||
inline bool_set
|
||||
operator&(bool_set __s, bool __t)
|
||||
{ return __s & bool_set(__t); }
|
||||
|
||||
|
||||
// 20.2.3.5 bool_set relational operators
|
||||
|
||||
inline bool_set
|
||||
operator==(bool __s, bool_set __t)
|
||||
{ return bool_set(__s) == __t; }
|
||||
|
||||
inline bool_set
|
||||
operator==(bool_set __s, bool __t)
|
||||
{ return __s == bool_set(__t); }
|
||||
|
||||
inline bool_set
|
||||
operator!=(bool __s, bool_set __t)
|
||||
{ return ! (__s == __t); }
|
||||
|
||||
inline bool_set
|
||||
operator!=(bool_set __s, bool __t)
|
||||
{ return ! (__s == __t); }
|
||||
|
||||
inline bool_set
|
||||
operator!=(bool_set __s, bool_set __t)
|
||||
{ return ! (__s == __t); }
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
}
|
||||
}
|
||||
|
||||
#include <tr2/bool_set.tcc>
|
||||
|
||||
#endif // _GLIBCXX_TR2_BOOL_SET
|
277
contrib/sdk/sources/libstdc++-v3/include/tr2/bool_set.tcc
Normal file
277
contrib/sdk/sources/libstdc++-v3/include/tr2/bool_set.tcc
Normal file
@@ -0,0 +1,277 @@
|
||||
// TR2 <bool_set> support files -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file tr2/bool_set.tcc
|
||||
* This is a TR2 C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_TR2_BOOL_SET_TCC
|
||||
#define _GLIBCXX_TR2_BOOL_SET_TCC 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace tr2
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
bool_set::_Bool_set_val
|
||||
bool_set::_S_not[4] =
|
||||
{ _S_true_, _S_false, _S_indet, _S_empty };
|
||||
|
||||
bool_set::_Bool_set_val
|
||||
bool_set::_S_xor[4][4] =
|
||||
{ { _S_false, _S_true_, _S_indet, _S_empty },
|
||||
{ _S_true_, _S_false, _S_indet, _S_empty },
|
||||
{ _S_indet, _S_indet, _S_indet, _S_empty },
|
||||
{ _S_empty, _S_empty, _S_empty, _S_empty } };
|
||||
|
||||
bool_set::_Bool_set_val
|
||||
bool_set::_S_or[4][4] =
|
||||
{ { _S_false, _S_true_, _S_indet, _S_empty },
|
||||
{ _S_true_, _S_true_, _S_true_, _S_empty },
|
||||
{ _S_indet, _S_true_, _S_indet, _S_empty },
|
||||
{ _S_empty, _S_empty, _S_empty, _S_empty } };
|
||||
|
||||
bool_set::_Bool_set_val
|
||||
bool_set::_S_and[4][4] =
|
||||
{ { _S_false, _S_false, _S_false, _S_empty },
|
||||
{ _S_false, _S_true_, _S_indet, _S_empty },
|
||||
{ _S_false, _S_indet, _S_indet, _S_empty },
|
||||
{ _S_empty, _S_empty, _S_empty, _S_empty } };
|
||||
|
||||
bool_set::_Bool_set_val
|
||||
bool_set::_S_eq[4][4] =
|
||||
{ { _S_true_, _S_false, _S_indet, _S_empty },
|
||||
{ _S_false, _S_true_, _S_indet, _S_empty },
|
||||
{ _S_indet, _S_indet, _S_indet, _S_empty },
|
||||
{ _S_empty, _S_empty, _S_empty, _S_empty } };
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
}
|
||||
}
|
||||
|
||||
// I object to these things.
|
||||
// The stuff in locale facets are for basic types.
|
||||
// I think we could hack operator<< and operator>>.
|
||||
|
||||
/**
|
||||
* @brief Numeric parsing.
|
||||
*
|
||||
* Parses the input stream into the bool @a v. It does so by calling
|
||||
* num_get::do_get().
|
||||
*
|
||||
* If ios_base::boolalpha is set, attempts to read
|
||||
* ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets
|
||||
* @a v to true or false if successful. Sets err to
|
||||
* ios_base::failbit if reading the string fails. Sets err to
|
||||
* ios_base::eofbit if the stream is emptied.
|
||||
*
|
||||
* If ios_base::boolalpha is not set, proceeds as with reading a long,
|
||||
* except if the value is 1, sets @a v to true, if the value is 0, sets
|
||||
* @a v to false, and otherwise set err to ios_base::failbit.
|
||||
*
|
||||
* @param in Start of input stream.
|
||||
* @param end End of input stream.
|
||||
* @param io Source of locale and flags.
|
||||
* @param err Error flags to set.
|
||||
* @param v Value to format and insert.
|
||||
* @return Iterator after reading.
|
||||
iter_type
|
||||
get(iter_type __in, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, bool& __v) const
|
||||
{ return this->do_get(__in, __end, __io, __err, __v); }
|
||||
*/
|
||||
/*
|
||||
template<typename _CharT, typename _InIter>
|
||||
_InIter
|
||||
num_get<_CharT, _InIter>::
|
||||
do_get(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, bool_set& __v) const
|
||||
{
|
||||
if (!(__io.flags() & ios_base::boolalpha))
|
||||
{
|
||||
// Parse bool values as long.
|
||||
// NB: We can't just call do_get(long) here, as it might
|
||||
// refer to a derived class.
|
||||
long __l = -1;
|
||||
__beg = _M_extract_int(__beg, __end, __io, __err, __l);
|
||||
if (__c >= _S_false && __c < _S_empty)
|
||||
__b._M_b = static_cast<_Bool_set_val>(__c);
|
||||
else
|
||||
{
|
||||
// What should we do here?
|
||||
__v = true;
|
||||
__err = ios_base::failbit;
|
||||
if (__beg == __end)
|
||||
__err |= ios_base::eofbit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse bool values as alphanumeric.
|
||||
typedef __numpunct_cache<_CharT> __cache_type;
|
||||
__use_cache<__cache_type> __uc;
|
||||
const locale& __loc = __io._M_getloc();
|
||||
const __cache_type* __lc = __uc(__loc);
|
||||
|
||||
bool __testf = true;
|
||||
bool __testt = true;
|
||||
bool __donef = __lc->_M_falsename_size == 0;
|
||||
bool __donet = __lc->_M_truename_size == 0;
|
||||
bool __testeof = false;
|
||||
size_t __n = 0;
|
||||
while (!__donef || !__donet)
|
||||
{
|
||||
if (__beg == __end)
|
||||
{
|
||||
__testeof = true;
|
||||
break;
|
||||
}
|
||||
|
||||
const char_type __c = *__beg;
|
||||
|
||||
if (!__donef)
|
||||
__testf = __c == __lc->_M_falsename[__n];
|
||||
|
||||
if (!__testf && __donet)
|
||||
break;
|
||||
|
||||
if (!__donet)
|
||||
__testt = __c == __lc->_M_truename[__n];
|
||||
|
||||
if (!__testt && __donef)
|
||||
break;
|
||||
|
||||
if (!__testt && !__testf)
|
||||
break;
|
||||
|
||||
++__n;
|
||||
++__beg;
|
||||
|
||||
__donef = !__testf || __n >= __lc->_M_falsename_size;
|
||||
__donet = !__testt || __n >= __lc->_M_truename_size;
|
||||
}
|
||||
if (__testf && __n == __lc->_M_falsename_size && __n)
|
||||
{
|
||||
__v = false;
|
||||
if (__testt && __n == __lc->_M_truename_size)
|
||||
__err = ios_base::failbit;
|
||||
else
|
||||
__err = __testeof ? ios_base::eofbit : ios_base::goodbit;
|
||||
}
|
||||
else if (__testt && __n == __lc->_M_truename_size && __n)
|
||||
{
|
||||
__v = true;
|
||||
__err = __testeof ? ios_base::eofbit : ios_base::goodbit;
|
||||
}
|
||||
else
|
||||
{
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 23. Num_get overflow result.
|
||||
__v = false;
|
||||
__err = ios_base::failbit;
|
||||
if (__testeof)
|
||||
__err |= ios_base::eofbit;
|
||||
}
|
||||
}
|
||||
return __beg;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Numeric formatting.
|
||||
*
|
||||
* Formats the boolean @a v and inserts it into a stream. It does so
|
||||
* by calling num_put::do_put().
|
||||
*
|
||||
* If ios_base::boolalpha is set, writes ctype<CharT>::truename() or
|
||||
* ctype<CharT>::falsename(). Otherwise formats @a v as an int.
|
||||
*
|
||||
* @param s Stream to write to.
|
||||
* @param io Source of locale and flags.
|
||||
* @param fill Char_type to use for filling.
|
||||
* @param v Value to format and insert.
|
||||
* @return Iterator after writing.
|
||||
iter_type
|
||||
put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
|
||||
{ return this->do_put(__s, __f, __fill, __v); }
|
||||
*/
|
||||
|
||||
/*
|
||||
template<typename _CharT, typename _OutIter>
|
||||
_OutIter
|
||||
num_put<_CharT, _OutIter>::
|
||||
do_put(iter_type __s, ios_base& __io, char_type __fill, bool_set __v) const
|
||||
{
|
||||
const ios_base::fmtflags __flags = __io.flags();
|
||||
if ((__flags & ios_base::boolalpha) == 0)
|
||||
{
|
||||
const long __l = __v;
|
||||
__s = _M_insert_int(__s, __io, __fill, __l);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef __numpunct_cache<_CharT> __cache_type;
|
||||
__use_cache<__cache_type> __uc;
|
||||
const locale& __loc = __io._M_getloc();
|
||||
const __cache_type* __lc = __uc(__loc);
|
||||
|
||||
const _CharT* __name = __v ? __lc->_M_truename
|
||||
: __lc->_M_falsename;
|
||||
int __len = __v ? __lc->_M_truename_size
|
||||
: __lc->_M_falsename_size;
|
||||
|
||||
const streamsize __w = __io.width();
|
||||
if (__w > static_cast<streamsize>(__len))
|
||||
{
|
||||
const streamsize __plen = __w - __len;
|
||||
_CharT* __ps
|
||||
= static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
|
||||
* __plen));
|
||||
|
||||
char_traits<_CharT>::assign(__ps, __plen, __fill);
|
||||
__io.width(0);
|
||||
|
||||
if ((__flags & ios_base::adjustfield) == ios_base::left)
|
||||
{
|
||||
__s = std::__write(__s, __name, __len);
|
||||
__s = std::__write(__s, __ps, __plen);
|
||||
}
|
||||
else
|
||||
{
|
||||
__s = std::__write(__s, __ps, __plen);
|
||||
__s = std::__write(__s, __name, __len);
|
||||
}
|
||||
return __s;
|
||||
}
|
||||
__io.width(0);
|
||||
__s = std::__write(__s, __name, __len);
|
||||
}
|
||||
return __s;
|
||||
}
|
||||
*/
|
||||
|
||||
#endif // _GLIBCXX_TR2_BOOL_SET_TCC
|
1472
contrib/sdk/sources/libstdc++-v3/include/tr2/dynamic_bitset
Normal file
1472
contrib/sdk/sources/libstdc++-v3/include/tr2/dynamic_bitset
Normal file
File diff suppressed because it is too large
Load Diff
59
contrib/sdk/sources/libstdc++-v3/include/tr2/ratio
Normal file
59
contrib/sdk/sources/libstdc++-v3/include/tr2/ratio
Normal file
@@ -0,0 +1,59 @@
|
||||
// TR2 <ratio> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file tr2/ratio
|
||||
* This is a TR2 C++ Library header.
|
||||
*/
|
||||
|
||||
#include <ratio>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace tr2
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<intmax_t _Pn, size_t _Bit,
|
||||
bool = _Bit < static_cast<size_t>
|
||||
(std::numeric_limits<intmax_t>::digits)>
|
||||
struct __safe_lshift
|
||||
{ static const intmax_t __value = 0; };
|
||||
|
||||
template<intmax_t _Pn, size_t _Bit>
|
||||
struct __safe_lshift<_Pn, _Bit, true>
|
||||
{ static const intmax_t __value = _Pn << _Bit; };
|
||||
|
||||
/// Add binary prefixes (IEC 60027-2 A.2 and ISO/IEC 80000).
|
||||
typedef ratio<__safe_lshift<1, 10>::__value, 1> kibi;
|
||||
typedef ratio<__safe_lshift<1, 20>::__value, 1> mebi;
|
||||
typedef ratio<__safe_lshift<1, 30>::__value, 1> gibi;
|
||||
typedef ratio<__safe_lshift<1, 40>::__value, 1> tebi;
|
||||
typedef ratio<__safe_lshift<1, 50>::__value, 1> pebi;
|
||||
typedef ratio<__safe_lshift<1, 60>::__value, 1> exbi;
|
||||
//typedef ratio<__safe_lshift<1, 70>::__value, 1> zebi;
|
||||
//typedef ratio<__safe_lshift<1, 80>::__value, 1> yobi;
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
}
|
||||
}
|
106
contrib/sdk/sources/libstdc++-v3/include/tr2/type_traits
Normal file
106
contrib/sdk/sources/libstdc++-v3/include/tr2/type_traits
Normal file
@@ -0,0 +1,106 @@
|
||||
// TR2 <type_traits> -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file tr2/type_traits
|
||||
* This is a TR2 C++ Library header.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_TR2_TYPE_TRAITS
|
||||
#define _GLIBCXX_TR2_TYPE_TRAITS 1
|
||||
|
||||
#pragma GCC system_header
|
||||
#include <type_traits>
|
||||
#include <bits/c++config.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
namespace tr2
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/**
|
||||
* @addtogroup metaprogramming
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* See N2965: Type traits and base classes
|
||||
* by Michael Spertus
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple typelist. Compile-time list of types.
|
||||
*/
|
||||
template<typename... _Elements>
|
||||
struct __reflection_typelist;
|
||||
|
||||
/// Specialization for an empty typelist.
|
||||
template<>
|
||||
struct __reflection_typelist<>
|
||||
{
|
||||
typedef std::true_type empty;
|
||||
};
|
||||
|
||||
/// Partial specialization.
|
||||
template<typename _First, typename... _Rest>
|
||||
struct __reflection_typelist<_First, _Rest...>
|
||||
{
|
||||
typedef std::false_type empty;
|
||||
|
||||
struct first
|
||||
{
|
||||
typedef _First type;
|
||||
};
|
||||
|
||||
struct rest
|
||||
{
|
||||
typedef __reflection_typelist<_Rest...> type;
|
||||
};
|
||||
};
|
||||
|
||||
/// Sequence abstraction metafunctions for manipulating a typelist.
|
||||
|
||||
|
||||
|
||||
/// Enumerate all the base classes of a class. Form of a typelist.
|
||||
template<typename _Tp>
|
||||
struct bases
|
||||
{
|
||||
typedef __reflection_typelist<__bases(_Tp)...> type;
|
||||
};
|
||||
|
||||
/// Enumerate all the direct base classes of a class. Form of a typelist.
|
||||
template<typename _Tp>
|
||||
struct direct_bases
|
||||
{
|
||||
typedef __reflection_typelist<__direct_bases(_Tp)...> type;
|
||||
};
|
||||
|
||||
/// @} group metaprogramming
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _GLIBCXX_TR2_TYPE_TRAITS
|
Reference in New Issue
Block a user