future: constexpr functions are implicitly inline.

2011-08-11  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/future: constexpr functions are implicitly inline.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/bits/move.h: Likewise.
	* include/bits/stl_pair.h: Likewise.

From-SVN: r177679
This commit is contained in:
Paolo Carlini 2011-08-11 17:53:05 +00:00 committed by Paolo Carlini
parent 4309e92c98
commit a4eeb82207
6 changed files with 55 additions and 47 deletions

View File

@ -1,3 +1,11 @@
2011-08-11 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/future: constexpr functions are implicitly inline.
* include/std/chrono: Likewise.
* include/std/complex: Likewise.
* include/bits/move.h: Likewise.
* include/bits/stl_pair.h: Likewise.
2011-08-07 Jonathan Wakely <jwakely.gcc@gmail.com> 2011-08-07 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/alloc_traits.h: Fix doxygen @headername. * include/bits/alloc_traits.h: Fix doxygen @headername.

View File

@ -58,12 +58,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// forward (as per N3143) /// forward (as per N3143)
template<typename _Tp> template<typename _Tp>
inline constexpr _Tp&& constexpr _Tp&&
forward(typename std::remove_reference<_Tp>::type& __t) noexcept forward(typename std::remove_reference<_Tp>::type& __t) noexcept
{ return static_cast<_Tp&&>(__t); } { return static_cast<_Tp&&>(__t); }
template<typename _Tp> template<typename _Tp>
inline constexpr _Tp&& constexpr _Tp&&
forward(typename std::remove_reference<_Tp>::type&& __t) noexcept forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
{ {
static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument" static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument"
@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return Same, moved. * @return Same, moved.
*/ */
template<typename _Tp> template<typename _Tp>
inline constexpr typename std::remove_reference<_Tp>::type&& constexpr typename std::remove_reference<_Tp>::type&&
move(_Tp&& __t) noexcept move(_Tp&& __t) noexcept
{ return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); } { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }

View File

@ -275,8 +275,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
// NB: DR 706. // NB: DR 706.
template<class _T1, class _T2> template<class _T1, class _T2>
inline constexpr pair<typename __decay_and_strip<_T1>::__type, constexpr pair<typename __decay_and_strip<_T1>::__type,
typename __decay_and_strip<_T2>::__type> typename __decay_and_strip<_T2>::__type>
make_pair(_T1&& __x, _T2&& __y) make_pair(_T1&& __x, _T2&& __y)
{ {
typedef typename __decay_and_strip<_T1>::__type __ds_type1; typedef typename __decay_and_strip<_T1>::__type __ds_type1;

View File

@ -168,8 +168,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
/// duration_cast /// duration_cast
template<typename _ToDur, typename _Rep, typename _Period> template<typename _ToDur, typename _Rep, typename _Period>
inline constexpr typename enable_if<__is_duration<_ToDur>::value, constexpr typename enable_if<__is_duration<_ToDur>::value,
_ToDur>::type _ToDur>::type
duration_cast(const duration<_Rep, _Period>& __d) duration_cast(const duration<_Rep, _Period>& __d)
{ {
typedef typename _ToDur::period __to_period; typedef typename _ToDur::period __to_period;
@ -352,8 +352,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr typename common_type<duration<_Rep1, _Period1>, constexpr typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type duration<_Rep2, _Period2>>::type
operator+(const duration<_Rep1, _Period1>& __lhs, operator+(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ {
@ -365,8 +365,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr typename common_type<duration<_Rep1, _Period1>, constexpr typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type duration<_Rep2, _Period2>>::type
operator-(const duration<_Rep1, _Period1>& __lhs, operator-(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ {
@ -386,7 +386,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
{ typedef typename common_type<_Rep1, _Rep2>::type type; }; { typedef typename common_type<_Rep1, _Rep2>::type type; };
template<typename _Rep1, typename _Period, typename _Rep2> template<typename _Rep1, typename _Period, typename _Rep2>
inline constexpr constexpr
duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period> duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period>
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
@ -396,13 +396,13 @@ _GLIBCXX_END_NAMESPACE_VERSION
} }
template<typename _Rep1, typename _Period, typename _Rep2> template<typename _Rep1, typename _Period, typename _Rep2>
inline constexpr constexpr
duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period> duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period>
operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
{ return __d * __s; } { return __d * __s; }
template<typename _Rep1, typename _Period, typename _Rep2> template<typename _Rep1, typename _Period, typename _Rep2>
inline constexpr duration<typename __common_rep_type<_Rep1, typename constexpr duration<typename __common_rep_type<_Rep1, typename
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period> enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
@ -411,9 +411,9 @@ _GLIBCXX_END_NAMESPACE_VERSION
return __cd(__cd(__d).count() / __s); return __cd(__cd(__d).count() / __s);
} }
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr typename common_type<_Rep1, _Rep2>::type constexpr typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, operator/(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ {
@ -425,7 +425,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
// DR 934. // DR 934.
template<typename _Rep1, typename _Period, typename _Rep2> template<typename _Rep1, typename _Period, typename _Rep2>
inline constexpr duration<typename __common_rep_type<_Rep1, typename constexpr duration<typename __common_rep_type<_Rep1, typename
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period> enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
@ -434,10 +434,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
return __cd(__cd(__d).count() % __s); return __cd(__cd(__d).count() % __s);
} }
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr typename common_type<duration<_Rep1, _Period1>, constexpr typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type duration<_Rep2, _Period2>>::type
operator%(const duration<_Rep1, _Period1>& __lhs, operator%(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ {
@ -450,7 +450,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
// comparisons // comparisons
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr bool constexpr bool
operator==(const duration<_Rep1, _Period1>& __lhs, operator==(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ {
@ -462,7 +462,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr bool constexpr bool
operator<(const duration<_Rep1, _Period1>& __lhs, operator<(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ {
@ -474,28 +474,28 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr bool constexpr bool
operator!=(const duration<_Rep1, _Period1>& __lhs, operator!=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs == __rhs); } { return !(__lhs == __rhs); }
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr bool constexpr bool
operator<=(const duration<_Rep1, _Period1>& __lhs, operator<=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ return !(__rhs < __lhs); } { return !(__rhs < __lhs); }
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr bool constexpr bool
operator>(const duration<_Rep1, _Period1>& __lhs, operator>(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ return __rhs < __lhs; } { return __rhs < __lhs; }
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr bool constexpr bool
operator>=(const duration<_Rep1, _Period1>& __lhs, operator>=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs < __rhs); } { return !(__lhs < __rhs); }
@ -575,8 +575,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
/// time_point_cast /// time_point_cast
template<typename _ToDur, typename _Clock, typename _Dur> template<typename _ToDur, typename _Clock, typename _Dur>
inline constexpr typename enable_if<__is_duration<_ToDur>::value, constexpr typename enable_if<__is_duration<_ToDur>::value,
time_point<_Clock, _ToDur>>::type time_point<_Clock, _ToDur>>::type
time_point_cast(const time_point<_Clock, _Dur>& __t) time_point_cast(const time_point<_Clock, _Dur>& __t)
{ {
typedef time_point<_Clock, _ToDur> __time_point; typedef time_point<_Clock, _ToDur> __time_point;
@ -585,7 +585,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Clock, typename _Dur1, template<typename _Clock, typename _Dur1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr time_point<_Clock, constexpr time_point<_Clock,
typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
operator+(const time_point<_Clock, _Dur1>& __lhs, operator+(const time_point<_Clock, _Dur1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
@ -598,7 +598,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Rep1, typename _Period1, template<typename _Rep1, typename _Period1,
typename _Clock, typename _Dur2> typename _Clock, typename _Dur2>
inline constexpr time_point<_Clock, constexpr time_point<_Clock,
typename common_type<duration<_Rep1, _Period1>, _Dur2>::type> typename common_type<duration<_Rep1, _Period1>, _Dur2>::type>
operator+(const duration<_Rep1, _Period1>& __lhs, operator+(const duration<_Rep1, _Period1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
@ -611,7 +611,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
template<typename _Clock, typename _Dur1, template<typename _Clock, typename _Dur1,
typename _Rep2, typename _Period2> typename _Rep2, typename _Period2>
inline constexpr time_point<_Clock, constexpr time_point<_Clock,
typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
operator-(const time_point<_Clock, _Dur1>& __lhs, operator-(const time_point<_Clock, _Dur1>& __lhs,
const duration<_Rep2, _Period2>& __rhs) const duration<_Rep2, _Period2>& __rhs)
@ -623,43 +623,43 @@ _GLIBCXX_END_NAMESPACE_VERSION
} }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr typename common_type<_Dur1, _Dur2>::type constexpr typename common_type<_Dur1, _Dur2>::type
operator-(const time_point<_Clock, _Dur1>& __lhs, operator-(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr bool constexpr bool
operator==(const time_point<_Clock, _Dur1>& __lhs, operator==(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr bool constexpr bool
operator!=(const time_point<_Clock, _Dur1>& __lhs, operator!=(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return !(__lhs == __rhs); } { return !(__lhs == __rhs); }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr bool constexpr bool
operator<(const time_point<_Clock, _Dur1>& __lhs, operator<(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr bool constexpr bool
operator<=(const time_point<_Clock, _Dur1>& __lhs, operator<=(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return !(__rhs < __lhs); } { return !(__rhs < __lhs); }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr bool constexpr bool
operator>(const time_point<_Clock, _Dur1>& __lhs, operator>(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return __rhs < __lhs; } { return __rhs < __lhs; }
template<typename _Clock, typename _Dur1, typename _Dur2> template<typename _Clock, typename _Dur1, typename _Dur2>
inline constexpr bool constexpr bool
operator>=(const time_point<_Clock, _Dur1>& __lhs, operator>=(const time_point<_Clock, _Dur1>& __lhs,
const time_point<_Clock, _Dur2>& __rhs) const time_point<_Clock, _Dur2>& __rhs)
{ return !(__lhs < __rhs); } { return !(__lhs < __rhs); }

View File

@ -531,12 +531,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Values // Values
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp> template<typename _Tp>
inline constexpr _Tp constexpr _Tp
real(const complex<_Tp>& __z) real(const complex<_Tp>& __z)
{ return __z.real(); } { return __z.real(); }
template<typename _Tp> template<typename _Tp>
inline constexpr _Tp constexpr _Tp
imag(const complex<_Tp>& __z) imag(const complex<_Tp>& __z)
{ return __z.imag(); } { return __z.imag(); }
#else #else

View File

@ -129,25 +129,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
deferred = 2 deferred = 2
}; };
inline constexpr launch operator&(launch __x, launch __y) constexpr launch operator&(launch __x, launch __y)
{ {
return static_cast<launch>( return static_cast<launch>(
static_cast<int>(__x) & static_cast<int>(__y)); static_cast<int>(__x) & static_cast<int>(__y));
} }
inline constexpr launch operator|(launch __x, launch __y) constexpr launch operator|(launch __x, launch __y)
{ {
return static_cast<launch>( return static_cast<launch>(
static_cast<int>(__x) | static_cast<int>(__y)); static_cast<int>(__x) | static_cast<int>(__y));
} }
inline constexpr launch operator^(launch __x, launch __y) constexpr launch operator^(launch __x, launch __y)
{ {
return static_cast<launch>( return static_cast<launch>(
static_cast<int>(__x) ^ static_cast<int>(__y)); static_cast<int>(__x) ^ static_cast<int>(__y));
} }
inline constexpr launch operator~(launch __x) constexpr launch operator~(launch __x)
{ return static_cast<launch>(~static_cast<int>(__x)); } { return static_cast<launch>(~static_cast<int>(__x)); }
inline launch& operator&=(launch& __x, launch __y) inline launch& operator&=(launch& __x, launch __y)