File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,10 @@ void TestPairTupleSize(void)
218218{
219219 int result = thrust::tuple_size< thrust::pair<int ,int > >::value;
220220 ASSERT_EQUAL (2 , result);
221+
222+ // test const pair
223+ int const_result = thrust::tuple_size< thrust::pair<int ,int > const >::value;
224+ ASSERT_EQUAL (2 , const_result);
221225};
222226DECLARE_UNITTEST (TestPairTupleSize);
223227
@@ -229,6 +233,13 @@ void TestPairTupleElement(void)
229233
230234 ASSERT_EQUAL_QUIET (typeid (int ), typeid (type0));
231235 ASSERT_EQUAL_QUIET (typeid (float ), typeid (type1));
236+
237+ // test const pair
238+ typedef thrust::tuple_element<0 , thrust::pair<int , float > const >::type const_type0;
239+ typedef thrust::tuple_element<1 , thrust::pair<int , float > const >::type const_type1;
240+
241+ ASSERT_EQUAL_QUIET (typeid (int const ), typeid (const_type0));
242+ ASSERT_EQUAL_QUIET (typeid (float const ), typeid (const_type1));
232243};
233244DECLARE_UNITTEST (TestPairTupleElement);
234245
Original file line number Diff line number Diff line change @@ -140,21 +140,21 @@ template <typename T1, typename T2>
140140
141141// specializations of tuple_element for pair
142142template <typename T1, typename T2>
143- struct tuple_element <0 , pair<T1,T2> >
143+ struct tuple_element <0 , const pair<T1,T2> >
144144{
145145 typedef T1 type;
146146}; // end tuple_element
147147
148148template <typename T1, typename T2>
149- struct tuple_element <1 , pair<T1,T2> >
149+ struct tuple_element <1 , const pair<T1,T2> >
150150{
151151 typedef T2 type;
152152}; // end tuple_element
153153
154154
155155// specialization of tuple_size for pair
156156template <typename T1, typename T2>
157- struct tuple_size < pair<T1,T2 > >
157+ struct tuple_size < const pair<T1,T2 > >
158158{
159159 static const unsigned int value = 2 ;
160160}; // end tuple_size
You can’t perform that action at this time.
0 commit comments