OSDN Git Service

first commit.
[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_