@@ -213,22 +213,42 @@ struct TestPairGet
213213};
214214SimpleUnitTest<TestPairGet, BuiltinNumericTypes> TestPairGetInstance;
215215
216+ using PairConstVolatileTypes =
217+ unittest::type_list<thrust::pair<int , float >, thrust::pair<int , float > const ,
218+ thrust::pair<int , float > const volatile >;
216219
217- void TestPairTupleSize (void )
220+ template <typename Pair>
221+ struct TestPairTupleSize
218222{
219- int result = thrust::tuple_size< thrust::pair<int ,int > >::value;
220- ASSERT_EQUAL (2 , result);
223+ void operator ()()
224+ {
225+ ASSERT_EQUAL (2 , static_cast <int >(thrust::tuple_size<Pair>::value));
226+ }
221227};
222- DECLARE_UNITTEST ( TestPairTupleSize) ;
228+ SimpleUnitTest< TestPairTupleSize, PairConstVolatileTypes> TestPairTupleSizeInstance ;
223229
224230
225231void TestPairTupleElement (void )
226232{
227- typedef thrust::tuple_element<0 , thrust::pair<int , float > >::type type0;
228- typedef thrust::tuple_element<1 , thrust::pair<int , float > >::type type1;
229-
230- ASSERT_EQUAL_QUIET (typeid (int ), typeid (type0));
231- ASSERT_EQUAL_QUIET (typeid (float ), typeid (type1));
233+ using type0 = thrust::tuple_element<0 , thrust::pair<int , float > >::type;
234+ using type1 = thrust::tuple_element<1 , thrust::pair<int , float > >::type;
235+ static_assert (std::is_same<int , type0>::value," " );
236+ static_assert (std::is_same<float , type1>::value," " );
237+
238+ using c_type0 = thrust::tuple_element<0 , thrust::pair<int , float > const >::type;
239+ using c_type1 = thrust::tuple_element<1 , thrust::pair<int , float > const >::type;
240+ static_assert (std::is_same<int const , c_type0>::value," " );
241+ static_assert (std::is_same<float const , c_type1>::value," " );
242+
243+ using v_type0 = thrust::tuple_element<0 , thrust::pair<int , float > volatile >::type;
244+ using v_type1 = thrust::tuple_element<1 , thrust::pair<int , float > volatile >::type;
245+ static_assert (std::is_same<int volatile , v_type0>::value," " );
246+ static_assert (std::is_same<float volatile , v_type1>::value," " );
247+
248+ using cv_type0 = thrust::tuple_element<0 , thrust::pair<int , float > const volatile >::type;
249+ using cv_type1 = thrust::tuple_element<1 , thrust::pair<int , float > const volatile >::type;
250+ static_assert (std::is_same<int const volatile , cv_type0>::value," " );
251+ static_assert (std::is_same<float const volatile , cv_type1>::value," " );
232252};
233253DECLARE_UNITTEST (TestPairTupleElement);
234254
0 commit comments