1 /*! 2 * \file tests/MetaProgramming/HasConstIterator.cxx 3 * \brief 4 * \author Thomas Helfer 5 * \date 19 oct 2006 6 * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights 7 * reserved. 8 * This project is publicly released under either the GNU GPL Licence 9 * or the CECILL-A licence. A copy of thoses licences are delivered 10 * with the sources of TFEL. CEA or EDF may also distribute this 11 * project under specific licensing conditions. 12 */ 13 14 15 #include<iostream> 16 #include<cstdlib> 17 #include<vector> 18 19 #include"TFEL/Metaprogramming/HasConstIterator.hxx" 20 #include"TFEL/Metaprogramming/HasIterator.hxx" 21 #include<type_traits> 22 23 template<typename T> 24 struct ConstIteratorHolder 25 { 26 using const_iterator = typename T::const_iterator; 27 }; 28 29 struct DoNothing 30 {}; 31 32 template<typename T> 33 struct Expr 34 : public std::conditional<tfel::meta::HasConstIterator<T>::cond, 35 ConstIteratorHolder<T>, 36 DoNothing>::type 37 {}; 38 39 /* coverity [UNCAUGHT_EXCEPT]*/ main()40int main(){ 41 Expr<std::vector<double> >::const_iterator p; 42 static_cast<void>(p); 43 return EXIT_SUCCESS; 44 45 } 46