OSDN Git Service

instance_counter のコメントを微修正
[gintenlib/gintenlib.git] / gintenlib / is_same_class.hpp
1 #ifndef GINTENLIB_INCLUDED_IS_SAME_CLASS_HPP_
2 #define GINTENLIB_INCLUDED_IS_SAME_CLASS_HPP_
3
4 /*
5       <gintenlib/is_same_class.hpp>
6
7   is_same_class : const, volatile を除いた状態での型の比較
8   
9   宣言:
10     template< typename T1, typename T2 >
11     class is_same_class
12     {
13       static bool const value;
14     };
15     template< typename T1, typename T2, typename T = void >
16     class enable_if_same_class
17       : enable_if< is_same_class<T1, T2>, T > {};
18
19   機能:
20     下の定義を見れば一目瞭然。remove_cv して is_same 比較します。
21     比較的多い操作なので、短く使えるように。
22
23 */
24
25 #include "enable_if.hpp"
26
27 #include <boost/type_traits/remove_cv.hpp>
28 #include <boost/type_traits/is_same.hpp>
29
30 namespace gintenlib
31 {
32   // CV 修飾を除いて同じクラスか否か
33   template<typename T1, typename T2>
34   struct is_same_class
35     : boost::is_same< typename boost::remove_cv<T1>::type, 
36       typename boost::remove_cv<T2>::type > {};
37   
38   // CV 修飾を除いて同じなら有効になる
39   template<typename T1, typename T2, typename T = void>
40   struct enable_if_same_class
41     : enable_if< is_same_class<T1, T2>, T > {};
42   
43 }   // namespace gintenlib
44
45 #endif  // #ifndef GINTENLIB_INCLUDED_IS_SAME_CLASS_HPP_