diff --git a/.gitignore b/.gitignore index 4c82b137..63b6d750 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,8 @@ *.gch build/ build-*/ +cmake-build-* /Debug/ ./extern/googletest/* +.vscode +.idea diff --git a/CMakeLists.txt b/CMakeLists.txt index ff477b58..7662679d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ install(DIRECTORY DESTINATION include) +SET(ENABLE_TESTS On CACHE BOOL "Test variable defaulting to '0'") if(ENABLE_TESTS) enable_testing() add_subdirectory(test) diff --git a/include/camp/camp.hpp b/include/camp/camp.hpp index 1ad0e878..1c7ab9c4 100644 --- a/include/camp/camp.hpp +++ b/include/camp/camp.hpp @@ -11,7 +11,6 @@ For details about use and distribution, please read LICENSE and NOTICE from #ifndef __CAMP_HPP #define __CAMP_HPP -#include #include #include "camp/defines.hpp" diff --git a/include/camp/concepts.hpp b/include/camp/concepts.hpp index e81852db..b8b83626 100644 --- a/include/camp/concepts.hpp +++ b/include/camp/concepts.hpp @@ -11,320 +11,189 @@ For details about use and distribution, please read LICENSE and NOTICE from #ifndef CAMP_CONCEPTS_HPP #define CAMP_CONCEPTS_HPP -#include #include -#include "camp/helpers.hpp" -#include "camp/list.hpp" -#include "camp/number.hpp" +#include "helpers.hpp" +#include "list.hpp" +#include "number.hpp" -#include "camp/type_traits/is_same.hpp" +#include "type_traits/detect.hpp" +#include "type_traits/enable_if.hpp" +#include "type_traits/is_same.hpp" +#include "type_traits/iterator_from.hpp" namespace camp { - namespace concepts { - - namespace metalib - { - using camp::is_same; - - /// negation metafunction of a value type - template - struct negate_t : num { - }; - - /// all_of metafunction of a value type list -- all must be "true" - template - struct all_of : metalib::is_same...>, list..., t>> { - }; - - /// none_of metafunction of a value type list -- all must be "false" - template - struct none_of - : metalib::is_same, idx_seq> { - }; - - /// any_of metafunction of a value type list -- at least one must be "true"" - template - struct any_of : negate_t> { - }; - - /// all_of metafunction of a bool list -- all must be "true" - template - struct all_of_t : all_of { - }; - - /// none_of metafunction of a bool list -- all must be "false" - template - struct none_of_t : none_of { - }; - - /// any_of metafunction of a bool list -- at least one must be "true"" - template - struct any_of_t : any_of { - }; - - } // end namespace metalib - -} // end namespace concepts -} // end namespace camp - -template -camp::true_type ___valid_expr___(T &&...) noexcept; -#define DefineConcept(...) decltype(___valid_expr___(__VA_ARGS__)) - -#define DefineTypeTraitFromConcept(TTName, ConceptName) \ - template \ - struct TTName : camp::concepts::requires_ { \ - } -namespace camp -{ -namespace concepts -{ - - namespace detail + namespace internal { - - template - struct TL { - }; - - template - struct voider { - using type = void; - }; - - template class Concept, - class TArgs> - struct detector { - using value_t = false_type; - using type = Default; - }; - - template class Concept, class... Args> - struct detector>::type, - Concept, - TL> { - using value_t = true_type; - using type = Concept; - }; - - template