From b67695ec6b5b1b2c2bd8ef4e14dbc2e26ced6990 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Mon, 14 May 2012 15:42:54 +0900 Subject: [PATCH] fix for clang 3.2 --- sprout/array.hpp | 14 +++-- sprout/config/auto_config.hpp | 2 +- sprout/functional/hash/hash.hpp | 13 +++-- sprout/io.hpp | 4 +- sprout/iterator/bytes_iterator.hpp | 2 +- sprout/iterator/reverse_iterator.hpp | 7 ++- sprout/pit.hpp | 4 +- sprout/string/tuple.hpp | 4 +- sprout/sub_array.hpp | 4 +- sprout/tuple/sscrisk/cel/utility.hpp | 10 ++-- sprout/tuple/tuple.hpp | 70 ++++++++++++++++++------- sprout/type/boost/mpl/string.hpp | 4 +- sprout/type/boost/mpl/vector.hpp | 4 +- sprout/type/boost/mpl/vector_c.hpp | 4 +- sprout/type/integral_array.hpp | 4 +- sprout/type/string.hpp | 4 +- sprout/type/tuple.hpp | 4 +- sprout/type/type_tuple.hpp | 10 ++-- sprout/utility/pair.hpp | 10 ++-- sprout/uuid/uuid.hpp | 4 +- sprout/variant/variant.hpp | 4 +- sprout/weed/parser/directive/repeat.hpp | 5 ++ sprout/weed/parser/numeric/bin.hpp | 3 +- sprout/weed/parser/numeric/hex.hpp | 3 +- sprout/weed/parser/numeric/int.hpp | 3 +- sprout/weed/parser/numeric/oct.hpp | 3 +- sprout/weed/parser/numeric/uint.hpp | 3 +- sprout/weed/traits/parser/limit_of.hpp | 2 +- 28 files changed, 133 insertions(+), 75 deletions(-) diff --git a/sprout/array.hpp b/sprout/array.hpp index 166bc950..8d1eaecd 100644 --- a/sprout/array.hpp +++ b/sprout/array.hpp @@ -239,8 +239,14 @@ namespace sprout { // make_common_array // template - inline SPROUT_CONSTEXPR sprout::array::type...>::type, sizeof...(Types)> make_common_array(Types&&... args) { - return sprout::array::type...>::type, sizeof...(Types)>{{sprout::forward(args)...}}; + inline SPROUT_CONSTEXPR sprout::array< + typename std::decay::type...>::type>::type, + sizeof...(Types) + > make_common_array(Types&&... args) { + return sprout::array< + typename std::decay::type...>::type>::type, + sizeof...(Types) + >{{sprout::forward(args)...}}; } namespace detail { @@ -287,7 +293,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::integral_constant {}; @@ -295,7 +301,7 @@ namespace std { // tuple_element // template - struct tuple_element > { + class tuple_element > { public: static_assert(I < N, "tuple_element<>: index out of range"); typedef T type; diff --git a/sprout/config/auto_config.hpp b/sprout/config/auto_config.hpp index 2728c9dc..472d6daa 100644 --- a/sprout/config/auto_config.hpp +++ b/sprout/config/auto_config.hpp @@ -59,7 +59,7 @@ # ifndef SPROUT_HAS_CONSTEXPR_CMATH_FUNCTION # define SPROUT_CONFIG_DISABLE_BUILTIN_CMATH_FUNCTION # endif // #ifdef SPROUT_HAS_CONSTEXPR_CMATH_FUNCTION -#endif // #ifndef SPROUT_CONFIG_DISABLE_SUPPORT_TEMPORARY_CONTAINER_ITERATION +#endif // #ifndef SPROUT_CONFIG_DISABLE_BUILTIN_CMATH_FUNCTION // // SPROUT_CONFIG_DISABLE_SUPPORT_TEMPORARY_CONTAINER_ITERATION diff --git a/sprout/functional/hash/hash.hpp b/sprout/functional/hash/hash.hpp index 8fbc194d..46c3ff75 100644 --- a/sprout/functional/hash/hash.hpp +++ b/sprout/functional/hash/hash.hpp @@ -148,10 +148,11 @@ namespace sprout { SPROUT_CONSTEXPR std::size_t hash_value(T* v) { return sprout::hash_detail::hash_value_pointer(v); } - template - SPROUT_CONSTEXPR std::size_t hash_value(T const (&v)[N]) { - return sprout::hash_range(&v[0], &v[0] + N); - } + // !!! +// template +// SPROUT_CONSTEXPR std::size_t hash_value(T const (&v)[N]) { +// return sprout::hash_range(&v[0], &v[0] + N); +// } // // to_hash @@ -161,6 +162,10 @@ namespace sprout { using sprout::hash_value; return hash_value(v); } + template + SPROUT_CONSTEXPR std::size_t to_hash(T const (&v)[N]) { + return sprout::hash_range(&v[0], &v[0] + N); + } // // hash_combine diff --git a/sprout/io.hpp b/sprout/io.hpp index 4814ff0b..0ca5d572 100644 --- a/sprout/io.hpp +++ b/sprout/io.hpp @@ -654,7 +654,7 @@ namespace sprout { } template< std::size_t I, typename Left, typename Right, - typename sprout::enabler_if<(I >= sprout::io::leaf_count::value)>::type = sprout::enabler + typename sprout::enabler_if<(I >= sprout::io::leaf_count::value)>::type > inline SPROUT_CONSTEXPR sprout::io::format_holder< typename sprout::io::leaf_at >::type @@ -777,7 +777,7 @@ namespace sprout { ); } } // namespace detail - template + template inline SPROUT_CONSTEXPR sprout::basic_string output(Expression const& expr) { return sprout::io::detail::output( diff --git a/sprout/iterator/bytes_iterator.hpp b/sprout/iterator/bytes_iterator.hpp index 0db1ab43..f6fbeaeb 100644 --- a/sprout/iterator/bytes_iterator.hpp +++ b/sprout/iterator/bytes_iterator.hpp @@ -100,7 +100,7 @@ namespace sprout { return !(lhs == rhs); } friend SPROUT_CONSTEXPR bool operator<(bytes_iterator const& lhs, bytes_iterator const& rhs) { - return lhs.it_ < rhs.it_ || lhs.it_ == rhs.it_ && lhs.i_ < rhs.i_; + return lhs.it_ < rhs.it_ || (lhs.it_ == rhs.it_ && lhs.i_ < rhs.i_); } friend SPROUT_CONSTEXPR bool operator>(bytes_iterator const& lhs, bytes_iterator const& rhs) { return rhs < lhs; diff --git a/sprout/iterator/reverse_iterator.hpp b/sprout/iterator/reverse_iterator.hpp index 1ad408f3..ba629dd7 100644 --- a/sprout/iterator/reverse_iterator.hpp +++ b/sprout/iterator/reverse_iterator.hpp @@ -35,7 +35,12 @@ namespace sprout { iterator_type deref_tmp; public: reverse_iterator() = default; - reverse_iterator(reverse_iterator const&) = default; + // !!! + //reverse_iterator(reverse_iterator const&) = default; + SPROUT_CONSTEXPR reverse_iterator(reverse_iterator const& other) + : current(other.current) + , deref_tmp(other.deref_tmp) + {} explicit SPROUT_CONSTEXPR reverse_iterator(iterator_type it) : current(it) , deref_tmp(sprout::prev(it)) diff --git a/sprout/pit.hpp b/sprout/pit.hpp index f21914c9..ae9b5dd8 100644 --- a/sprout/pit.hpp +++ b/sprout/pit.hpp @@ -217,7 +217,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::tuple_size {}; @@ -225,7 +225,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public std::tuple_element {}; } // namespace std diff --git a/sprout/string/tuple.hpp b/sprout/string/tuple.hpp index e139f671..199c4494 100644 --- a/sprout/string/tuple.hpp +++ b/sprout/string/tuple.hpp @@ -11,7 +11,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::integral_constant {}; @@ -19,7 +19,7 @@ namespace std { // tuple_element // template - struct tuple_element > { + class tuple_element > { public: static_assert(I < N, "tuple_element<>: index out of range"); typedef T type; diff --git a/sprout/sub_array.hpp b/sprout/sub_array.hpp index 56bf2e35..650d3660 100644 --- a/sprout/sub_array.hpp +++ b/sprout/sub_array.hpp @@ -854,7 +854,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::tuple_size::type> {}; @@ -862,7 +862,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public std::tuple_element::type> {}; } // namespace std diff --git a/sprout/tuple/sscrisk/cel/utility.hpp b/sprout/tuple/sscrisk/cel/utility.hpp index d02cd0fe..852f1ac0 100644 --- a/sprout/tuple/sscrisk/cel/utility.hpp +++ b/sprout/tuple/sscrisk/cel/utility.hpp @@ -13,7 +13,7 @@ namespace sprout { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::integral_constant {}; @@ -22,20 +22,20 @@ namespace sprout { // namespace detail { template - struct tuple_element_impl; + class tuple_element_impl; template - struct tuple_element_impl<0, sscrisk::cel::pair > { + class tuple_element_impl<0, sscrisk::cel::pair > { public: typedef T1 type; }; template - struct tuple_element_impl<1, sscrisk::cel::pair > { + class tuple_element_impl<1, sscrisk::cel::pair > { public: typedef T2 type; }; } // namespace detail template - struct tuple_element > + class tuple_element > : public sprout::tuples::detail::tuple_element_impl > {}; diff --git a/sprout/tuple/tuple.hpp b/sprout/tuple/tuple.hpp index f31f8385..d9cd146a 100644 --- a/sprout/tuple/tuple.hpp +++ b/sprout/tuple/tuple.hpp @@ -221,18 +221,50 @@ namespace sprout { } }; - template - struct and_impl + template + struct and_impl; + template<> + struct and_impl + : public std::true_type + {}; + template<> + struct and_impl : public std::false_type {}; - template + template struct and_impl : public std::integral_constant::value> {}; - - template + template + struct and_impl + : public std::false_type + {}; + template struct and_ - : public sprout::tuples::detail::and_impl + : public sprout::tuples::detail::and_impl + {}; + + template + struct or_impl; + template<> + struct or_impl + : public std::true_type + {}; + template<> + struct or_impl + : public std::false_type + {}; + template + struct or_impl + : public std::true_type + {}; + template + struct or_impl + : public std::integral_constant::value> + {}; + template + struct or_ + : public sprout::tuples::detail::and_impl {}; } // namespace detail @@ -384,14 +416,14 @@ namespace sprout { namespace detail { template - struct tuple_element_impl; + class tuple_element_impl; template - struct tuple_element_impl<0, sprout::tuples::tuple > { + class tuple_element_impl<0, sprout::tuples::tuple > { public: typedef Head type; }; template - struct tuple_element_impl > + class tuple_element_impl > : public sprout::tuples::detail::tuple_element_impl > {}; } // namespace detail @@ -410,7 +442,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::integral_constant {}; @@ -418,7 +450,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public sprout::tuples::detail::tuple_element_impl > {}; } // namespace std @@ -429,19 +461,19 @@ namespace sprout { // tuple_size // template - struct tuple_size + class tuple_size : public std::tuple_size {}; template - struct tuple_size + class tuple_size : public sprout::tuples::tuple_size {}; template - struct tuple_size + class tuple_size : public sprout::tuples::tuple_size {}; template - struct tuple_size + class tuple_size : public sprout::tuples::tuple_size {}; @@ -449,19 +481,19 @@ namespace sprout { // tuple_element // template - struct tuple_element + class tuple_element : public std::tuple_element {}; template - struct tuple_element + class tuple_element : public sprout::tuples::tuple_element {}; template - struct tuple_element + class tuple_element : public sprout::tuples::tuple_element {}; template - struct tuple_element + class tuple_element : public sprout::tuples::tuple_element {}; diff --git a/sprout/type/boost/mpl/string.hpp b/sprout/type/boost/mpl/string.hpp index 6a7b5cfc..966ee30a 100644 --- a/sprout/type/boost/mpl/string.hpp +++ b/sprout/type/boost/mpl/string.hpp @@ -35,14 +35,14 @@ namespace sprout { // tuple_size // template - struct tuple_size > + class tuple_size > : public boost::mpl::size > {}; // // tuple_element // template - struct tuple_element > + class tuple_element > : public boost::mpl::at_c, I> {}; diff --git a/sprout/type/boost/mpl/vector.hpp b/sprout/type/boost/mpl/vector.hpp index 7048cd51..846432eb 100644 --- a/sprout/type/boost/mpl/vector.hpp +++ b/sprout/type/boost/mpl/vector.hpp @@ -29,14 +29,14 @@ namespace sprout { // tuple_size // template - struct tuple_size > + class tuple_size > : public boost::mpl::size > {}; // // tuple_element // template - struct tuple_element > + class tuple_element > : public boost::mpl::at_c, I> {}; } // namespace types diff --git a/sprout/type/boost/mpl/vector_c.hpp b/sprout/type/boost/mpl/vector_c.hpp index 07823b19..44545ed7 100644 --- a/sprout/type/boost/mpl/vector_c.hpp +++ b/sprout/type/boost/mpl/vector_c.hpp @@ -29,14 +29,14 @@ namespace sprout { // tuple_size // template - struct tuple_size > + class tuple_size > : public boost::mpl::size > {}; // // tuple_element // template - struct tuple_element > + class tuple_element > : public boost::mpl::at_c, I> {}; } // namespace types diff --git a/sprout/type/integral_array.hpp b/sprout/type/integral_array.hpp index 3da3e910..3282cafd 100644 --- a/sprout/type/integral_array.hpp +++ b/sprout/type/integral_array.hpp @@ -28,7 +28,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::tuple_size...> > {}; @@ -36,7 +36,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public std::tuple_element...> > {}; } // namespace std diff --git a/sprout/type/string.hpp b/sprout/type/string.hpp index a3001631..b7c5118e 100644 --- a/sprout/type/string.hpp +++ b/sprout/type/string.hpp @@ -24,7 +24,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::tuple_size > {}; @@ -32,7 +32,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public std::tuple_element > {}; } // namespace std diff --git a/sprout/type/tuple.hpp b/sprout/type/tuple.hpp index c0ca255f..dfbce411 100644 --- a/sprout/type/tuple.hpp +++ b/sprout/type/tuple.hpp @@ -26,14 +26,14 @@ namespace sprout { // tuple_size // template - struct tuple_size + class tuple_size : public std::tuple_size {}; // // tuple_element // template - struct tuple_element + class tuple_element : public std::tuple_element {}; } // namespace types diff --git a/sprout/type/type_tuple.hpp b/sprout/type/type_tuple.hpp index 9ddafdb5..bbdee005 100644 --- a/sprout/type/type_tuple.hpp +++ b/sprout/type/type_tuple.hpp @@ -23,14 +23,14 @@ namespace sprout { namespace detail { template - struct tuple_element_impl; + class tuple_element_impl; template - struct tuple_element_impl<0, sprout::types::type_tuple > { + class tuple_element_impl<0, sprout::types::type_tuple > { public: typedef Head type; }; template - struct tuple_element_impl > + class tuple_element_impl > : public sprout::types::detail::tuple_element_impl > {}; } // namespace detail @@ -44,7 +44,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::integral_constant {}; @@ -52,7 +52,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public sprout::types::detail::tuple_element_impl > {}; } // namespace std diff --git a/sprout/utility/pair.hpp b/sprout/utility/pair.hpp index 2e1ccbf4..ae2ff9a9 100644 --- a/sprout/utility/pair.hpp +++ b/sprout/utility/pair.hpp @@ -169,14 +169,14 @@ namespace sprout { namespace tuples { namespace detail { template - struct tuple_element_impl; + class tuple_element_impl; template - struct tuple_element_impl<0, sprout::pair > { + class tuple_element_impl<0, sprout::pair > { public: typedef T1 type; }; template - struct tuple_element_impl<1, sprout::pair > { + class tuple_element_impl<1, sprout::pair > { public: typedef T2 type; }; @@ -189,7 +189,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::integral_constant {}; @@ -197,7 +197,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public sprout::tuples::detail::tuple_element_impl > {}; } // namespace std diff --git a/sprout/uuid/uuid.hpp b/sprout/uuid/uuid.hpp index ed1e7c28..70485d78 100644 --- a/sprout/uuid/uuid.hpp +++ b/sprout/uuid/uuid.hpp @@ -264,7 +264,7 @@ namespace std { // tuple_size // template<> - struct tuple_size { + class tuple_size { public: typedef std::integral_constant type; SPROUT_STATIC_CONSTEXPR std::size_t value = type::value; @@ -274,7 +274,7 @@ namespace std { // tuple_element // template - struct tuple_element { + class tuple_element { public: static_assert(I < 16, "tuple_element<>: index out of range"); typedef sprout::uuids::uuid::value_type type; diff --git a/sprout/variant/variant.hpp b/sprout/variant/variant.hpp index ea335353..59918848 100644 --- a/sprout/variant/variant.hpp +++ b/sprout/variant/variant.hpp @@ -266,7 +266,7 @@ namespace std { // tuple_size // template - struct tuple_size > + class tuple_size > : public std::tuple_size::tuple_type> {}; @@ -274,7 +274,7 @@ namespace std { // tuple_element // template - struct tuple_element > + class tuple_element > : public std::tuple_element::tuple_type> {}; } // namespace std diff --git a/sprout/weed/parser/directive/repeat.hpp b/sprout/weed/parser/directive/repeat.hpp index 94a89649..5f1743a3 100644 --- a/sprout/weed/parser/directive/repeat.hpp +++ b/sprout/weed/parser/directive/repeat.hpp @@ -22,6 +22,11 @@ namespace sprout { struct repeat_p : public sprout::weed::parser_base { + public: + template + struct attribute; + template + struct result; private: template struct eval { diff --git a/sprout/weed/parser/numeric/bin.hpp b/sprout/weed/parser/numeric/bin.hpp index 92cb05c5..bcaa20e3 100644 --- a/sprout/weed/parser/numeric/bin.hpp +++ b/sprout/weed/parser/numeric/bin.hpp @@ -1,6 +1,7 @@ #ifndef SPROUT_WEED_PARSER_NUMERIC_BIN_HPP #define SPROUT_WEED_PARSER_NUMERIC_BIN_HPP +#include #include #include #include @@ -11,7 +12,7 @@ namespace sprout { // // bin // - SPROUT_STATIC_CONSTEXPR auto bin = sprout::weed::uint_p(); + SPROUT_STATIC_CONSTEXPR auto bin = sprout::weed::uint_p(-1)>(); // // bin8 diff --git a/sprout/weed/parser/numeric/hex.hpp b/sprout/weed/parser/numeric/hex.hpp index 827bb714..9f4799af 100644 --- a/sprout/weed/parser/numeric/hex.hpp +++ b/sprout/weed/parser/numeric/hex.hpp @@ -1,6 +1,7 @@ #ifndef SPROUT_WEED_PARSER_NUMERIC_HEX_HPP #define SPROUT_WEED_PARSER_NUMERIC_HEX_HPP +#include #include #include #include @@ -11,7 +12,7 @@ namespace sprout { // // hex // - SPROUT_STATIC_CONSTEXPR auto hex = sprout::weed::uint_p(); + SPROUT_STATIC_CONSTEXPR auto hex = sprout::weed::uint_p(-1)>(); // // hex8 diff --git a/sprout/weed/parser/numeric/int.hpp b/sprout/weed/parser/numeric/int.hpp index f830bccd..996de598 100644 --- a/sprout/weed/parser/numeric/int.hpp +++ b/sprout/weed/parser/numeric/int.hpp @@ -1,6 +1,7 @@ #ifndef SPROUT_WEED_PARSER_NUMERIC_INT_HPP #define SPROUT_WEED_PARSER_NUMERIC_INT_HPP +#include #include #include #include @@ -11,7 +12,7 @@ namespace sprout { // // int_ // - SPROUT_STATIC_CONSTEXPR auto int_ = sprout::weed::int_p(); + SPROUT_STATIC_CONSTEXPR auto int_ = sprout::weed::int_p(-1)>(); // // int8 diff --git a/sprout/weed/parser/numeric/oct.hpp b/sprout/weed/parser/numeric/oct.hpp index 8d65a4eb..ecda3a2a 100644 --- a/sprout/weed/parser/numeric/oct.hpp +++ b/sprout/weed/parser/numeric/oct.hpp @@ -1,6 +1,7 @@ #ifndef SPROUT_WEED_PARSER_NUMERIC_OCT_HPP #define SPROUT_WEED_PARSER_NUMERIC_OCT_HPP +#include #include #include #include @@ -11,7 +12,7 @@ namespace sprout { // // oct // - SPROUT_STATIC_CONSTEXPR auto oct = sprout::weed::uint_p(); + SPROUT_STATIC_CONSTEXPR auto oct = sprout::weed::uint_p(-1)>(); // // oct8 diff --git a/sprout/weed/parser/numeric/uint.hpp b/sprout/weed/parser/numeric/uint.hpp index ef78321e..1a2ca4d1 100644 --- a/sprout/weed/parser/numeric/uint.hpp +++ b/sprout/weed/parser/numeric/uint.hpp @@ -1,6 +1,7 @@ #ifndef SPROUT_WEED_PARSER_NUMERIC_UINT_HPP #define SPROUT_WEED_PARSER_NUMERIC_UINT_HPP +#include #include #include #include @@ -11,7 +12,7 @@ namespace sprout { // // uint_ // - SPROUT_STATIC_CONSTEXPR auto uint_ = sprout::weed::uint_p(); + SPROUT_STATIC_CONSTEXPR auto uint_ = sprout::weed::uint_p(-1)>(); // // uint8 diff --git a/sprout/weed/traits/parser/limit_of.hpp b/sprout/weed/traits/parser/limit_of.hpp index 3cfc069d..e739aa65 100644 --- a/sprout/weed/traits/parser/limit_of.hpp +++ b/sprout/weed/traits/parser/limit_of.hpp @@ -15,7 +15,7 @@ namespace sprout { // template struct limit_of - : public std::integral_constant + : public std::integral_constant(-1)> {}; template struct limit_of