[Groonga-commit] groonga/grnxx at aaf6e61 [master] Disable unused traits.

Back to archive index

susumu.yata null+****@clear*****
Wed Jun 5 16:48:56 JST 2013


susumu.yata	2013-06-05 16:48:56 +0900 (Wed, 05 Jun 2013)

  New Revision: aaf6e61d5a357a4631fdcb162ae7c09aa7f081a9
  https://github.com/groonga/grnxx/commit/aaf6e61d5a357a4631fdcb162ae7c09aa7f081a9

  Message:
    Disable unused traits.
    
    These traits are not compilable with g++-4.7.

  Modified files:
    lib/grnxx/traits.hpp
    test/test_traits.cpp

  Modified: lib/grnxx/traits.hpp (+37 -37)
===================================================================
--- lib/grnxx/traits.hpp    2013-06-05 16:17:49 +0900 (309dfa8)
+++ lib/grnxx/traits.hpp    2013-06-05 16:48:56 +0900 (20c58bb)
@@ -37,38 +37,38 @@ template <> struct PreferredArgument<GeoPoint> {
   using Type = GeoPoint;
 };
 
-// Check if operator<() is defined or not.
-struct HasLessHelper {
-  template <typename T>
-  static auto check(T *p) -> decltype(p->operator<(*p), std::true_type());
-  template <typename T>
-  static auto check(T *p) -> decltype(operator<(*p, *p), std::true_type());
-  template <typename>
-  static auto check(...) -> decltype(std::false_type());
-};
-// Check if T has operator<() or not.
-template <typename T>
-struct HasLess {
-  static constexpr bool value() {
-    return std::conditional<std::is_scalar<T>::value, std::true_type,
-                            decltype(HasLessHelper::check<T>(0))>::type::value;
-  }
-};
+//// Check if operator<() is defined or not.
+//struct HasLessHelper {
+//  template <typename T>
+//  static auto check(T *p) -> decltype(p->operator<(*p), std::true_type());
+//  template <typename T>
+//  static auto check(T *p) -> decltype(operator<(*p, *p), std::true_type());
+//  template <typename>
+//  static auto check(...) -> decltype(std::false_type());
+//};
+//// Check if T has operator<() or not.
+//template <typename T>
+//struct HasLess {
+//  static constexpr bool value() {
+//    return std::conditional<std::is_scalar<T>::value, std::true_type,
+//                            decltype(HasLessHelper::check<T>(0))>::type::value;
+//  }
+//};
 
-// Check if T has starts_with() or not.
-struct HasStartsWithHelper {
-  template <typename T>
-  static auto check(T *p) -> decltype(p->starts_with(*p), std::true_type());
-  template <typename>
-  static auto check(...) -> decltype(std::false_type());
-};
-// Check if T has operator<() or not.
-template <typename T>
-struct HasStartsWith {
-  static constexpr bool value() {
-    return decltype(HasStartsWithHelper::check<T>(0))::value;
-  }
-};
+//// Check if T has starts_with() or not.
+//struct HasStartsWithHelper {
+//  template <typename T>
+//  static auto check(T *p) -> decltype(p->starts_with(*p), std::true_type());
+//  template <typename>
+//  static auto check(...) -> decltype(std::false_type());
+//};
+//// Check if T has operator<() or not.
+//template <typename T>
+//struct HasStartsWith {
+//  static constexpr bool value() {
+//    return decltype(HasStartsWithHelper::check<T>(0))::value;
+//  }
+//};
 
 // Type traits.
 template <typename T>
@@ -76,12 +76,12 @@ struct Traits {
   using Type = T;
   using ArgumentType = typename PreferredArgument<T>::Type;
 
-  static constexpr bool has_less() {
-    return HasLess<T>::value();
-  }
-  static constexpr bool has_starts_with() {
-    return HasStartsWith<T>::value();
-  }
+//  static constexpr bool has_less() {
+//    return HasLess<T>::value();
+//  }
+//  static constexpr bool has_starts_with() {
+//    return HasStartsWith<T>::value();
+//  }
 };
 
 }  // namespace grnxx

  Modified: test/test_traits.cpp (+15 -15)
===================================================================
--- test/test_traits.cpp    2013-06-05 16:17:49 +0900 (c167d00)
+++ test/test_traits.cpp    2013-06-05 16:48:56 +0900 (bb57079)
@@ -55,19 +55,19 @@ void test_argument_type() {
                        typename grnxx::Traits<Point>::ArgumentType>::value));
 }
 
-void test_has_less() {
-  assert(grnxx::Traits<int>::has_less());
-  assert(!grnxx::Traits<Point>::has_less());
-  assert(grnxx::Traits<Something>::has_less());
-  assert(grnxx::Traits<Something2>::has_less());
-}
-
-void test_has_starts_with() {
-  assert(!grnxx::Traits<int>::has_starts_with());
-  assert(!grnxx::Traits<Point>::has_starts_with());
-  assert(grnxx::Traits<Something>::has_starts_with());
-  assert(!grnxx::Traits<Something2>::has_starts_with());
-}
+//void test_has_less() {
+//  assert(grnxx::Traits<int>::has_less());
+//  assert(!grnxx::Traits<Point>::has_less());
+//  assert(grnxx::Traits<Something>::has_less());
+//  assert(grnxx::Traits<Something2>::has_less());
+//}
+
+//void test_has_starts_with() {
+//  assert(!grnxx::Traits<int>::has_starts_with());
+//  assert(!grnxx::Traits<Point>::has_starts_with());
+//  assert(grnxx::Traits<Something>::has_starts_with());
+//  assert(!grnxx::Traits<Something2>::has_starts_with());
+//}
 
 }  // namespace
 
@@ -78,8 +78,8 @@ int main() {
 
   test_type();
   test_argument_type();
-  test_has_less();
-  test_has_starts_with();
+//  test_has_less();
+//  test_has_starts_with();
 
   return 0;
 }
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index