1 // (C) Copyright Gennadiy Rozental 2012-2014. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 6 // See http://www.boost.org/libs/test for the library home page. 7 // 8 // File : $RCSfile$ 9 // 10 // Version : $Revision$ 11 // 12 // Description : defines the is_cstring type trait 13 // *************************************************************************** 14 15 #ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP 16 #define BOOST_TEST_UTILS_IS_CSTRING_HPP 17 18 // Boost 19 #include <boost/mpl/bool.hpp> 20 #include <boost/type_traits/is_same.hpp> 21 #include <boost/type_traits/decay.hpp> 22 #include <boost/type_traits/remove_pointer.hpp> 23 24 //____________________________________________________________________________// 25 26 namespace boost { 27 namespace unit_test { 28 29 // ************************************************************************** // 30 // ************** is_cstring ************** // 31 // ************************************************************************** // 32 33 namespace ut_detail { 34 35 template<typename T> 36 struct is_cstring_impl : public mpl::false_ {}; 37 38 template<typename T> 39 struct is_cstring_impl<T const*> : public is_cstring_impl<T*> {}; 40 41 template<typename T> 42 struct is_cstring_impl<T const* const> : public is_cstring_impl<T*> {}; 43 44 template<> 45 struct is_cstring_impl<char*> : public mpl::true_ {}; 46 47 template<> 48 struct is_cstring_impl<wchar_t*> : public mpl::true_ {}; 49 50 } // namespace ut_detail 51 52 template<typename T> 53 struct is_cstring : public ut_detail::is_cstring_impl<typename decay<T>::type> {}; 54 55 } // namespace unit_test 56 } // namespace boost 57 58 #endif // BOOST_TEST_UTILS_IS_CSTRING_HPP 59