|
||||
File indexing completed on 2025-01-18 09:51:46
0001 //---------------------------------------------------------------------------- 0002 /// @file traits.hpp 0003 /// @brief this file contains the metaprogramming classes compare_iter and 0004 /// enable_if_not_integral 0005 /// @author Copyright(c) 2016 Francisco Jose Tapia (fjtapia@gmail.com )\n 0006 /// Distributed under the Boost Software License, Version 1.0.\n 0007 /// ( See accompanying file LICENSE_1_0.txt or copy at 0008 /// http://www.boost.org/LICENSE_1_0.txt ) 0009 /// @version 0.1 0010 /// 0011 //----------------------------------------------------------------------------- 0012 #ifndef __BOOST_SORT_COMMON_UTIL_TRAITS_HPP 0013 #define __BOOST_SORT_COMMON_UTIL_TRAITS_HPP 0014 0015 #include <ciso646> 0016 #include <functional> 0017 #include <iterator> 0018 #include <type_traits> 0019 0020 namespace boost 0021 { 0022 namespace sort 0023 { 0024 namespace common 0025 { 0026 namespace util 0027 { 0028 //---------------------------------------------------------------------------- 0029 // USING SENTENCES 0030 //---------------------------------------------------------------------------- 0031 using std::iterator_traits; 0032 0033 // 0034 //--------------------------------------------------------------------------- 0035 /// @class value_iter 0036 /// @brief From the iterator, obtain the type pointed by it 0037 /// @remarks The main utility of this, is simplify the default template 0038 /// parameter of comparison 0039 //--------------------------------------------------------------------------- 0040 template<class iter_t> 0041 using value_iter = typename iterator_traits< iter_t >::value_type; 0042 // 0043 //--------------------------------------------------------------------------- 0044 /// @class compare_iter 0045 /// @brief From the iterator, received as template parameter, obtain the type 0046 /// of the object pointed by the iterator, and with this define the 0047 /// std::less with this type obtained 0048 /// @remarks The main utility of this, is simplify the default template 0049 /// parameter of comparison 0050 //--------------------------------------------------------------------------- 0051 template<class iter_t> 0052 using compare_iter = std::less< value_iter< iter_t > >; 0053 0054 // 0055 //--------------------------------------------------------------------------- 0056 /// @class enable_if_not_integral 0057 /// @brief This is a SFINAE class for to detect if the third parameter in the 0058 /// invocation of the parallel sorting algorithms is an integer 0059 /// representing the number of threads to use or is a comparison object 0060 /// @remarks 0061 //--------------------------------------------------------------------------- 0062 template<class T> 0063 using enable_if_not_integral = 0064 typename std::enable_if< !std::is_integral< T >::value >::type; 0065 // 0066 //--------------------------------------------------------------------------- 0067 /// @class enable_if_integral 0068 /// @brief This is a SFINAE class for to detect if the third parameter in the 0069 /// invocation of the parallel sorting algorithms is an integer 0070 /// representing the number of threads to use or is a comparison object 0071 /// @remarks 0072 //--------------------------------------------------------------------------- 0073 template<class T> 0074 using enable_if_integral = 0075 typename std::enable_if< std::is_integral< T >::value >::type; 0076 0077 // 0078 //--------------------------------------------------------------------------- 0079 /// @class enable_if_string 0080 /// @brief This is a SFINAE class for to detect if the parameter is a 0081 /// std::string for to apply specialized parameters in the invocation 0082 /// of the block_indirect_sort algorithm 0083 /// @remarks 0084 //--------------------------------------------------------------------------- 0085 template<class T> 0086 using enable_if_string = 0087 typename std::enable_if< std::is_same< T, std::string >::value >::type; 0088 0089 // 0090 //--------------------------------------------------------------------------- 0091 /// @class enable_if_not_string 0092 /// @brief This is a SFINAE class for to detect if the parameter is a 0093 /// std::string for to apply specialized parameters in the invocation 0094 /// of the block_indirect_sort algorithm 0095 /// @remarks 0096 //--------------------------------------------------------------------------- 0097 template<class T> 0098 using enable_if_not_string = 0099 typename std::enable_if<! std::is_same< T, std::string >::value >::type; 0100 0101 // 0102 //--------------------------------------------------------------------------- 0103 /// @class constructor 0104 /// @brief create a functor with the constructor of a class for to be invoked 0105 /// from a bind or a lambda 0106 /// @remarks 0107 //--------------------------------------------------------------------------- 0108 template<class T> 0109 struct constructor 0110 { 0111 template<class ... Args> 0112 void operator()(Args && ... args) 0113 { 0114 T(std::forward<Args> (args) ...); 0115 } 0116 }; 0117 // 0118 //**************************************************************************** 0119 };// End namespace util 0120 };// End namespace common 0121 };// End namespace sort 0122 };// End namespace boost 0123 //**************************************************************************** 0124 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |