[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 8c9fbae 1/2: Require C++11: assume SFINAE
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 8c9fbae 1/2: Require C++11: assume SFINAE |
Date: |
Sun, 22 Jan 2017 21:44:54 +0000 (UTC) |
branch: master
commit 8c9fbaeb16e85ebc5718cf7385e0ec728bfd4445
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Require C++11: assume SFINAE
---
contains.hpp | 68 -----------------------------------------------------
contains_test.cpp | 2 --
2 files changed, 70 deletions(-)
diff --git a/contains.hpp b/contains.hpp
index edb99c5..a88e1b9 100644
--- a/contains.hpp
+++ b/contains.hpp
@@ -28,18 +28,6 @@
#include <algorithm> // std::find()
-#if defined __BORLANDC__ || defined __COMO_VERSION__ && __COMO_VERSION__ <=
4303
-# define LMI_NO_SFINAE
-# include <deque>
-# include <list>
-# include <map>
-# include <set>
-# include <string>
-# include <vector>
-#endif // defined __BORLANDC__ || defined __COMO_VERSION__ && __COMO_VERSION__
<= 4303
-
-#if !defined LMI_NO_SFINAE
-
/// Determine whether a class has a find() member.
///
/// See:
@@ -147,61 +135,5 @@ bool contains
return t.end() != t.find(element);
}
-#else // defined LMI_NO_SFINAE
-
-// Strings. Only std::string is supported here: compilers that can't
-// handle SFINAE might not provide std::basic_string either.
-
-bool contains(std::string const& t, std::string const& element)
-{
- return std::string::npos != t.find(element);
-}
-
-bool contains(std::string const& t, char const* element)
-{
- return std::string::npos != t.find(element);
-}
-
-bool contains(std::string const& t, char element)
-{
- return std::string::npos != t.find(element);
-}
-
-// Associative containers.
-
-template<typename K, typename T>
-bool contains(std::map<K,T> const& t, typename std::map<K,T>::key_type const&
element)
-{
- return t.end() != t.find(element);
-}
-
-template<typename T>
-bool contains(std::set<T> const& t, typename std::set<T>::key_type const&
element)
-{
- return t.end() != t.find(element);
-}
-
-// Sequences.
-
-template<typename T>
-bool contains(std::deque<T> const& t, T const& element)
-{
- return t.end() != std::find(t.begin(), t.end(), element);
-}
-
-template<typename T>
-bool contains(std::list<T> const& t, T const& element)
-{
- return t.end() != std::find(t.begin(), t.end(), element);
-}
-
-template<typename T>
-bool contains(std::vector<T> const& t, T const& element)
-{
- return t.end() != std::find(t.begin(), t.end(), element);
-}
-
-#endif // defined LMI_NO_SFINAE
-
#endif // contains_hpp
diff --git a/contains_test.cpp b/contains_test.cpp
index 766d13a..593ca5e 100644
--- a/contains_test.cpp
+++ b/contains_test.cpp
@@ -39,7 +39,6 @@ struct LacksFind { };
void test_has_member_find()
{
-#if !defined LMI_NO_SFINAE
static_assert( has_member_find<HasFind >::value, "");
static_assert(!has_member_find<LacksFind>::value, "");
@@ -48,7 +47,6 @@ void test_has_member_find()
static_assert( has_member_find<std::map <int,int> >::value, "");
static_assert( has_member_find<std::set <int > >::value, "");
static_assert(!has_member_find<std::vector<int > >::value, "");
-#endif // !defined LMI_NO_SFINAE
}
/// Test standard "containers" for which find() makes sense.