Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
6f864679
Commit
6f864679
authored
Jun 30, 2015
by
Jonathan Wakely
Committed by
Jonathan Wakely
Jun 30, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* include/bits/stl_pair.h: Replace class keyword with typename.
From-SVN: r225190
parent
bf7818bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
23 deletions
+27
-23
libstdc++-v3/ChangeLog
+4
-0
libstdc++-v3/include/bits/stl_pair.h
+23
-23
No files found.
libstdc++-v3/ChangeLog
View file @
6f864679
2015-06-30 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_pair.h: Replace class keyword with typename.
2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com>
2015-06-30 Ville Voutilainen <ville.voutilainen@gmail.com>
Implement N4387, "Improving pair and tuple", and LWG 2367.
Implement N4387, "Improving pair and tuple", and LWG 2367.
...
...
libstdc++-v3/include/bits/stl_pair.h
View file @
6f864679
...
@@ -124,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -124,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @tparam _T1 Type of first object.
* @tparam _T1 Type of first object.
* @tparam _T2 Type of second object.
* @tparam _T2 Type of second object.
*/
*/
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
struct
pair
struct
pair
{
{
typedef
_T1
first_type
;
/// @c first_type is the first bound type
typedef
_T1
first_type
;
/// @c first_type is the first bound type
...
@@ -170,18 +170,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -170,18 +170,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/** There is also a templated copy ctor for the @c pair class itself. */
/** There is also a templated copy ctor for the @c pair class itself. */
#if __cplusplus < 201103L
#if __cplusplus < 201103L
template
<
class
_U1
,
class
_U2
>
template
<
typename
_U1
,
typename
_U2
>
pair
(
const
pair
<
_U1
,
_U2
>&
__p
)
pair
(
const
pair
<
_U1
,
_U2
>&
__p
)
:
first
(
__p
.
first
),
second
(
__p
.
second
)
{
}
:
first
(
__p
.
first
),
second
(
__p
.
second
)
{
}
#else
#else
template
<
class
_U1
,
class
_U2
,
typename
template
<
typename
_U1
,
typename
_U2
,
typename
enable_if
<
_ConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
enable_if
<
_ConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
&&
_ImplicitlyConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
&&
_ImplicitlyConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
bool
>::
type
=
true
>
bool
>::
type
=
true
>
constexpr
pair
(
const
pair
<
_U1
,
_U2
>&
__p
)
constexpr
pair
(
const
pair
<
_U1
,
_U2
>&
__p
)
:
first
(
__p
.
first
),
second
(
__p
.
second
)
{
}
:
first
(
__p
.
first
),
second
(
__p
.
second
)
{
}
template
<
class
_U1
,
class
_U2
,
typename
template
<
typename
_U1
,
typename
_U2
,
typename
enable_if
<
_ConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
enable_if
<
_ConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
&&
!
_ImplicitlyConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
&&
!
_ImplicitlyConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
bool
>::
type
=
false
>
bool
>::
type
=
false
>
...
@@ -192,7 +192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -192,7 +192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr
pair
(
pair
&&
)
=
default
;
constexpr
pair
(
pair
&&
)
=
default
;
// DR 811.
// DR 811.
template
<
class
_U1
,
typename
template
<
typename
_U1
,
typename
enable_if
<
_ConstructiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
enable_if
<
_ConstructiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_T2
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_T2
>
()
&&
_ImplicitlyConvertiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
&&
_ImplicitlyConvertiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
...
@@ -202,7 +202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -202,7 +202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr
pair
(
_U1
&&
__x
,
const
_T2
&
__y
)
constexpr
pair
(
_U1
&&
__x
,
const
_T2
&
__y
)
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
__y
)
{
}
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
__y
)
{
}
template
<
class
_U1
,
typename
template
<
typename
_U1
,
typename
enable_if
<
_ConstructiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
enable_if
<
_ConstructiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_T2
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_T2
>
()
&&
(
!
_ImplicitlyConvertiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
&&
(
!
_ImplicitlyConvertiblePair
<
_T2
,
_T2
,
_T2
,
_T2
>
()
...
@@ -212,7 +212,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -212,7 +212,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit
constexpr
pair
(
_U1
&&
__x
,
const
_T2
&
__y
)
explicit
constexpr
pair
(
_U1
&&
__x
,
const
_T2
&
__y
)
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
__y
)
{
}
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
__y
)
{
}
template
<
class
_U2
,
typename
template
<
typename
_U2
,
typename
enable_if
<
_ConstructiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
enable_if
<
_ConstructiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_T1
,
_U2
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_T1
,
_U2
>
()
&&
_ImplicitlyConvertiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
&&
_ImplicitlyConvertiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
...
@@ -222,7 +222,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -222,7 +222,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr
pair
(
const
_T1
&
__x
,
_U2
&&
__y
)
constexpr
pair
(
const
_T1
&
__x
,
_U2
&&
__y
)
:
first
(
__x
),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
:
first
(
__x
),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
template
<
class
_U2
,
typename
template
<
typename
_U2
,
typename
enable_if
<
_ConstructiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
enable_if
<
_ConstructiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_T1
,
_U2
>
()
&&
_MoveConstructiblePair
<
_T1
,
_T2
,
_T1
,
_U2
>
()
&&
(
!
_ImplicitlyConvertiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
&&
(
!
_ImplicitlyConvertiblePair
<
_T1
,
_T1
,
_T1
,
_T1
>
()
...
@@ -232,7 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -232,7 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit
pair
(
const
_T1
&
__x
,
_U2
&&
__y
)
explicit
pair
(
const
_T1
&
__x
,
_U2
&&
__y
)
:
first
(
__x
),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
:
first
(
__x
),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
template
<
class
_U1
,
class
_U2
,
typename
template
<
typename
_U1
,
typename
_U2
,
typename
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
&&
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
&&
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
_U1
,
_U2
>
(),
...
@@ -240,7 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -240,7 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr
pair
(
_U1
&&
__x
,
_U2
&&
__y
)
constexpr
pair
(
_U1
&&
__x
,
_U2
&&
__y
)
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
template
<
class
_U1
,
class
_U2
,
typename
template
<
typename
_U1
,
typename
_U2
,
typename
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
&&
!
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
&&
!
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
_U1
,
_U2
>
(),
...
@@ -249,7 +249,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -249,7 +249,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
:
first
(
std
::
forward
<
_U1
>
(
__x
)),
second
(
std
::
forward
<
_U2
>
(
__y
))
{
}
template
<
class
_U1
,
class
_U2
,
typename
template
<
typename
_U1
,
typename
_U2
,
typename
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
&&
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
&&
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
_U1
,
_U2
>
(),
...
@@ -258,7 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -258,7 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
:
first
(
std
::
forward
<
_U1
>
(
__p
.
first
)),
:
first
(
std
::
forward
<
_U1
>
(
__p
.
first
)),
second
(
std
::
forward
<
_U2
>
(
__p
.
second
))
{
}
second
(
std
::
forward
<
_U2
>
(
__p
.
second
))
{
}
template
<
class
_U1
,
class
_U2
,
typename
template
<
typename
_U1
,
typename
_U2
,
typename
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
enable_if
<
_MoveConstructiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
()
&&
!
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
&&
!
_ImplicitlyMoveConvertiblePair
<
_T1
,
_T2
,
_U1
,
_U2
>
(),
_U1
,
_U2
>
(),
...
@@ -288,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -288,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return
*
this
;
return
*
this
;
}
}
template
<
class
_U1
,
class
_U2
>
template
<
typename
_U1
,
typename
_U2
>
pair
&
pair
&
operator
=
(
const
pair
<
_U1
,
_U2
>&
__p
)
operator
=
(
const
pair
<
_U1
,
_U2
>&
__p
)
{
{
...
@@ -297,7 +297,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -297,7 +297,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return
*
this
;
return
*
this
;
}
}
template
<
class
_U1
,
class
_U2
>
template
<
typename
_U1
,
typename
_U2
>
pair
&
pair
&
operator
=
(
pair
<
_U1
,
_U2
>&&
__p
)
operator
=
(
pair
<
_U1
,
_U2
>&&
__p
)
{
{
...
@@ -325,38 +325,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -325,38 +325,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
};
/// Two pairs of the same type are equal iff their members are equal.
/// Two pairs of the same type are equal iff their members are equal.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
_GLIBCXX_CONSTEXPR
bool
inline
_GLIBCXX_CONSTEXPR
bool
operator
==
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
operator
==
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
{
return
__x
.
first
==
__y
.
first
&&
__x
.
second
==
__y
.
second
;
}
{
return
__x
.
first
==
__y
.
first
&&
__x
.
second
==
__y
.
second
;
}
/// <http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html>
/// <http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html>
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
_GLIBCXX_CONSTEXPR
bool
inline
_GLIBCXX_CONSTEXPR
bool
operator
<
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
operator
<
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
{
return
__x
.
first
<
__y
.
first
{
return
__x
.
first
<
__y
.
first
||
(
!
(
__y
.
first
<
__x
.
first
)
&&
__x
.
second
<
__y
.
second
);
}
||
(
!
(
__y
.
first
<
__x
.
first
)
&&
__x
.
second
<
__y
.
second
);
}
/// Uses @c operator== to find the result.
/// Uses @c operator== to find the result.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
_GLIBCXX_CONSTEXPR
bool
inline
_GLIBCXX_CONSTEXPR
bool
operator
!=
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
operator
!=
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
{
return
!
(
__x
==
__y
);
}
{
return
!
(
__x
==
__y
);
}
/// Uses @c operator< to find the result.
/// Uses @c operator< to find the result.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
_GLIBCXX_CONSTEXPR
bool
inline
_GLIBCXX_CONSTEXPR
bool
operator
>
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
operator
>
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
{
return
__y
<
__x
;
}
{
return
__y
<
__x
;
}
/// Uses @c operator< to find the result.
/// Uses @c operator< to find the result.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
_GLIBCXX_CONSTEXPR
bool
inline
_GLIBCXX_CONSTEXPR
bool
operator
<=
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
operator
<=
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
{
return
!
(
__y
<
__x
);
}
{
return
!
(
__y
<
__x
);
}
/// Uses @c operator< to find the result.
/// Uses @c operator< to find the result.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
_GLIBCXX_CONSTEXPR
bool
inline
_GLIBCXX_CONSTEXPR
bool
operator
>=
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
operator
>=
(
const
pair
<
_T1
,
_T2
>&
__x
,
const
pair
<
_T1
,
_T2
>&
__y
)
{
return
!
(
__x
<
__y
);
}
{
return
!
(
__x
<
__y
);
}
...
@@ -365,7 +365,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -365,7 +365,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// See std::pair::swap().
/// See std::pair::swap().
// Note: no std::swap overloads in C++03 mode, this has performance
// Note: no std::swap overloads in C++03 mode, this has performance
// implications, see, eg, libstdc++/38466.
// implications, see, eg, libstdc++/38466.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
void
inline
void
swap
(
pair
<
_T1
,
_T2
>&
__x
,
pair
<
_T1
,
_T2
>&
__y
)
swap
(
pair
<
_T1
,
_T2
>&
__x
,
pair
<
_T1
,
_T2
>&
__y
)
noexcept
(
noexcept
(
__x
.
swap
(
__y
)))
noexcept
(
noexcept
(
__x
.
swap
(
__y
)))
...
@@ -386,7 +386,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -386,7 +386,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// 181. make_pair() unintended behavior
// 181. make_pair() unintended behavior
#if __cplusplus >= 201103L
#if __cplusplus >= 201103L
// NB: DR 706.
// NB: DR 706.
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
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
)
...
@@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
...
@@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return
__pair_type
(
std
::
forward
<
_T1
>
(
__x
),
std
::
forward
<
_T2
>
(
__y
));
return
__pair_type
(
std
::
forward
<
_T1
>
(
__x
),
std
::
forward
<
_T2
>
(
__y
));
}
}
#else
#else
template
<
class
_T1
,
class
_T2
>
template
<
typename
_T1
,
typename
_T2
>
inline
pair
<
_T1
,
_T2
>
inline
pair
<
_T1
,
_T2
>
make_pair
(
_T1
__x
,
_T2
__y
)
make_pair
(
_T1
__x
,
_T2
__y
)
{
return
pair
<
_T1
,
_T2
>
(
__x
,
__y
);
}
{
return
pair
<
_T1
,
_T2
>
(
__x
,
__y
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment