fix for clang 3.2

This commit is contained in:
bolero-MURAKAMI 2012-05-14 15:42:54 +09:00
parent 3a999dd70c
commit b67695ec6b
28 changed files with 133 additions and 75 deletions

View file

@ -239,8 +239,14 @@ namespace sprout {
// make_common_array
//
template<typename... Types>
inline SPROUT_CONSTEXPR sprout::array<typename std::common_type<typename std::decay<Types>::type...>::type, sizeof...(Types)> make_common_array(Types&&... args) {
return sprout::array<typename std::common_type<typename std::decay<Types>::type...>::type, sizeof...(Types)>{{sprout::forward<Types>(args)...}};
inline SPROUT_CONSTEXPR sprout::array<
typename std::decay<typename std::common_type<typename std::decay<Types>::type...>::type>::type,
sizeof...(Types)
> make_common_array(Types&&... args) {
return sprout::array<
typename std::decay<typename std::common_type<typename std::decay<Types>::type...>::type>::type,
sizeof...(Types)
>{{sprout::forward<Types>(args)...}};
}
namespace detail {
@ -287,7 +293,7 @@ namespace std {
// tuple_size
//
template<typename T, std::size_t N>
struct tuple_size<sprout::array<T, N> >
class tuple_size<sprout::array<T, N> >
: public std::integral_constant<std::size_t, N>
{};
@ -295,7 +301,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename T, std::size_t N>
struct tuple_element<I, sprout::array<T, N> > {
class tuple_element<I, sprout::array<T, N> > {
public:
static_assert(I < N, "tuple_element<>: index out of range");
typedef T type;

View file

@ -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

View file

@ -148,10 +148,11 @@ namespace sprout {
SPROUT_CONSTEXPR std::size_t hash_value(T* v) {
return sprout::hash_detail::hash_value_pointer(v);
}
template<typename T, std::size_t N >
SPROUT_CONSTEXPR std::size_t hash_value(T const (&v)[N]) {
return sprout::hash_range(&v[0], &v[0] + N);
}
// !!!
// template<typename T, std::size_t N>
// 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<typename T, std::size_t N>
SPROUT_CONSTEXPR std::size_t to_hash(T const (&v)[N]) {
return sprout::hash_range(&v[0], &v[0] + N);
}
//
// hash_combine

View file

@ -654,7 +654,7 @@ namespace sprout {
}
template<
std::size_t I, typename Left, typename Right,
typename sprout::enabler_if<(I >= sprout::io::leaf_count<Left>::value)>::type = sprout::enabler
typename sprout::enabler_if<(I >= sprout::io::leaf_count<Left>::value)>::type
>
inline SPROUT_CONSTEXPR sprout::io::format_holder<
typename sprout::io::leaf_at<I, sprout::io::format_expression<Left, Right> >::type
@ -777,7 +777,7 @@ namespace sprout {
);
}
} // namespace detail
template<std::size_t N, typename Elem = char, typename Expression>
template<std::size_t N, typename Elem, typename Expression>
inline SPROUT_CONSTEXPR sprout::basic_string<Elem, N>
output(Expression const& expr) {
return sprout::io::detail::output<Elem, N>(

View file

@ -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;

View file

@ -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))

View file

@ -217,7 +217,7 @@ namespace std {
// tuple_size
//
template<typename Container>
struct tuple_size<sprout::pit<Container> >
class tuple_size<sprout::pit<Container> >
: public std::tuple_size<Container>
{};
@ -225,7 +225,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename Container>
struct tuple_element<I, sprout::pit<Container> >
class tuple_element<I, sprout::pit<Container> >
: public std::tuple_element<I, Container>
{};
} // namespace std

View file

@ -11,7 +11,7 @@ namespace std {
// tuple_size
//
template<typename T, std::size_t N, typename Traits>
struct tuple_size<sprout::basic_string<T, N, Traits> >
class tuple_size<sprout::basic_string<T, N, Traits> >
: public std::integral_constant<std::size_t, N>
{};
@ -19,7 +19,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename T, std::size_t N, typename Traits>
struct tuple_element<I, sprout::basic_string<T, N, Traits> > {
class tuple_element<I, sprout::basic_string<T, N, Traits> > {
public:
static_assert(I < N, "tuple_element<>: index out of range");
typedef T type;

View file

@ -854,7 +854,7 @@ namespace std {
// tuple_size
//
template<typename Container>
struct tuple_size<sprout::sub_array<Container> >
class tuple_size<sprout::sub_array<Container> >
: public std::tuple_size<typename std::remove_reference<Container>::type>
{};
@ -862,7 +862,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename Container>
struct tuple_element<I, sprout::sub_array<Container> >
class tuple_element<I, sprout::sub_array<Container> >
: public std::tuple_element<I, typename std::remove_reference<Container>::type>
{};
} // namespace std

View file

@ -13,7 +13,7 @@ namespace sprout {
// tuple_size
//
template<typename T1, typename T2>
struct tuple_size<sscrisk::cel::pair<T1, T2> >
class tuple_size<sscrisk::cel::pair<T1, T2> >
: public std::integral_constant<std::size_t, 2>
{};
@ -22,20 +22,20 @@ namespace sprout {
//
namespace detail {
template<std::size_t I, typename T>
struct tuple_element_impl;
class tuple_element_impl;
template<typename T1, typename T2>
struct tuple_element_impl<0, sscrisk::cel::pair<T1, T2> > {
class tuple_element_impl<0, sscrisk::cel::pair<T1, T2> > {
public:
typedef T1 type;
};
template<typename T1, typename T2>
struct tuple_element_impl<1, sscrisk::cel::pair<T1, T2> > {
class tuple_element_impl<1, sscrisk::cel::pair<T1, T2> > {
public:
typedef T2 type;
};
} // namespace detail
template<std::size_t I, typename T1, typename T2>
struct tuple_element<I, sscrisk::cel::pair<T1, T2> >
class tuple_element<I, sscrisk::cel::pair<T1, T2> >
: public sprout::tuples::detail::tuple_element_impl<I, sscrisk::cel::pair<T1, T2> >
{};

View file

@ -221,18 +221,50 @@ namespace sprout {
}
};
template<bool Cond, typename... Tail>
struct and_impl
template<bool Head, bool... Tail>
struct and_impl;
template<>
struct and_impl<true>
: public std::true_type
{};
template<>
struct and_impl<false>
: public std::false_type
{};
template<typename... Tail>
template<bool... Tail>
struct and_impl<true, Tail...>
: public std::integral_constant<bool, sprout::tuples::detail::and_impl<Tail...>::value>
{};
template<typename Head, typename... Tail>
template<bool... Tail>
struct and_impl<false, Tail...>
: public std::false_type
{};
template<typename... Types>
struct and_
: public sprout::tuples::detail::and_impl<Head::value, Tail...>
: public sprout::tuples::detail::and_impl<Types::value...>
{};
template<bool Head, bool... Tail>
struct or_impl;
template<>
struct or_impl<true>
: public std::true_type
{};
template<>
struct or_impl<false>
: public std::false_type
{};
template<bool... Tail>
struct or_impl<true, Tail...>
: public std::true_type
{};
template<bool... Tail>
struct or_impl<false, Tail...>
: public std::integral_constant<bool, sprout::tuples::detail::or_impl<Tail...>::value>
{};
template<typename... Types>
struct or_
: public sprout::tuples::detail::and_impl<Types::value...>
{};
} // namespace detail
@ -384,14 +416,14 @@ namespace sprout {
namespace detail {
template<std::size_t I, typename T>
struct tuple_element_impl;
class tuple_element_impl;
template<typename Head, typename... Tail>
struct tuple_element_impl<0, sprout::tuples::tuple<Head, Tail...> > {
class tuple_element_impl<0, sprout::tuples::tuple<Head, Tail...> > {
public:
typedef Head type;
};
template<std::size_t I, typename Head, typename... Tail>
struct tuple_element_impl<I, sprout::tuples::tuple<Head, Tail...> >
class tuple_element_impl<I, sprout::tuples::tuple<Head, Tail...> >
: public sprout::tuples::detail::tuple_element_impl<I - 1, sprout::tuples::tuple<Tail...> >
{};
} // namespace detail
@ -410,7 +442,7 @@ namespace std {
// tuple_size
//
template<typename... Types>
struct tuple_size<sprout::tuples::tuple<Types...> >
class tuple_size<sprout::tuples::tuple<Types...> >
: public std::integral_constant<std::size_t, sizeof...(Types)>
{};
@ -418,7 +450,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename... Types>
struct tuple_element<I, sprout::tuples::tuple<Types...> >
class tuple_element<I, sprout::tuples::tuple<Types...> >
: public sprout::tuples::detail::tuple_element_impl<I, sprout::tuples::tuple<Types...> >
{};
} // namespace std
@ -429,19 +461,19 @@ namespace sprout {
// tuple_size
//
template<typename T>
struct tuple_size
class tuple_size
: public std::tuple_size<T>
{};
template<typename T>
struct tuple_size<T const>
class tuple_size<T const>
: public sprout::tuples::tuple_size<T>
{};
template<typename T>
struct tuple_size<T volatile>
class tuple_size<T volatile>
: public sprout::tuples::tuple_size<T>
{};
template<typename T>
struct tuple_size<T const volatile>
class tuple_size<T const volatile>
: public sprout::tuples::tuple_size<T>
{};
@ -449,19 +481,19 @@ namespace sprout {
// tuple_element
//
template<std::size_t I, typename T>
struct tuple_element
class tuple_element
: public std::tuple_element<I, T>
{};
template<std::size_t I, typename T>
struct tuple_element<I, T const>
class tuple_element<I, T const>
: public sprout::tuples::tuple_element<I, T>
{};
template<std::size_t I, typename T>
struct tuple_element<I, T volatile>
class tuple_element<I, T volatile>
: public sprout::tuples::tuple_element<I, T>
{};
template<std::size_t I, typename T>
struct tuple_element<I, T const volatile>
class tuple_element<I, T const volatile>
: public sprout::tuples::tuple_element<I, T>
{};

View file

@ -35,14 +35,14 @@ namespace sprout {
// tuple_size
//
template<int... Values>
struct tuple_size<boost::mpl::string<Values...> >
class tuple_size<boost::mpl::string<Values...> >
: public boost::mpl::size<boost::mpl::string<Values...> >
{};
//
// tuple_element
//
template<std::size_t I, int... Values>
struct tuple_element<I, boost::mpl::string<Values...> >
class tuple_element<I, boost::mpl::string<Values...> >
: public boost::mpl::at_c<boost::mpl::string<Values...>, I>
{};

View file

@ -29,14 +29,14 @@ namespace sprout {
// tuple_size
//
template<typename... Types>
struct tuple_size<boost::mpl::vector<Types...> >
class tuple_size<boost::mpl::vector<Types...> >
: public boost::mpl::size<boost::mpl::vector<Types...> >
{};
//
// tuple_element
//
template<std::size_t I, typename... Types>
struct tuple_element<I, boost::mpl::vector<Types...> >
class tuple_element<I, boost::mpl::vector<Types...> >
: public boost::mpl::at_c<boost::mpl::vector<Types...>, I>
{};
} // namespace types

View file

@ -29,14 +29,14 @@ namespace sprout {
// tuple_size
//
template<typename T, T... Values>
struct tuple_size<boost::mpl::vector_c<T, Values...> >
class tuple_size<boost::mpl::vector_c<T, Values...> >
: public boost::mpl::size<boost::mpl::vector_c<T, Values...> >
{};
//
// tuple_element
//
template<std::size_t I, typename T, T... Values>
struct tuple_element<I, boost::mpl::vector_c<T, Values...> >
class tuple_element<I, boost::mpl::vector_c<T, Values...> >
: public boost::mpl::at_c<boost::mpl::vector_c<T, Values...>, I>
{};
} // namespace types

View file

@ -28,7 +28,7 @@ namespace std {
// tuple_size
//
template<typename T, T... Values>
struct tuple_size<sprout::types::integral_array<T, Values...> >
class tuple_size<sprout::types::integral_array<T, Values...> >
: public std::tuple_size<sprout::types::type_tuple<std::integral_constant<T, Values>...> >
{};
@ -36,7 +36,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename T, T... Values>
struct tuple_element<I, sprout::types::integral_array<T, Values...> >
class tuple_element<I, sprout::types::integral_array<T, Values...> >
: public std::tuple_element<I, sprout::types::type_tuple<std::integral_constant<T, Values>...> >
{};
} // namespace std

View file

@ -24,7 +24,7 @@ namespace std {
// tuple_size
//
template<typename T, T... Values>
struct tuple_size<sprout::types::basic_string<T, Values...> >
class tuple_size<sprout::types::basic_string<T, Values...> >
: public std::tuple_size<sprout::types::integral_array<T, Values...> >
{};
@ -32,7 +32,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename T, T... Values>
struct tuple_element<I, sprout::types::basic_string<T, Values...> >
class tuple_element<I, sprout::types::basic_string<T, Values...> >
: public std::tuple_element<I, sprout::types::integral_array<T, Values...> >
{};
} // namespace std

View file

@ -26,14 +26,14 @@ namespace sprout {
// tuple_size
//
template<typename T, typename Enable = void>
struct tuple_size
class tuple_size
: public std::tuple_size<T>
{};
//
// tuple_element
//
template<std::size_t I, typename T, typename Enable = void>
struct tuple_element
class tuple_element
: public std::tuple_element<I, T>
{};
} // namespace types

View file

@ -23,14 +23,14 @@ namespace sprout {
namespace detail {
template<std::size_t I, typename T>
struct tuple_element_impl;
class tuple_element_impl;
template<typename Head, typename... Tail>
struct tuple_element_impl<0, sprout::types::type_tuple<Head, Tail...> > {
class tuple_element_impl<0, sprout::types::type_tuple<Head, Tail...> > {
public:
typedef Head type;
};
template<std::size_t I, typename Head, typename... Tail>
struct tuple_element_impl<I, sprout::types::type_tuple<Head, Tail...> >
class tuple_element_impl<I, sprout::types::type_tuple<Head, Tail...> >
: public sprout::types::detail::tuple_element_impl<I - 1, sprout::types::type_tuple<Tail...> >
{};
} // namespace detail
@ -44,7 +44,7 @@ namespace std {
// tuple_size
//
template<typename... Types>
struct tuple_size<sprout::types::type_tuple<Types...> >
class tuple_size<sprout::types::type_tuple<Types...> >
: public std::integral_constant<std::size_t, sizeof...(Types)>
{};
@ -52,7 +52,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename... Types>
struct tuple_element<I, sprout::types::type_tuple<Types...> >
class tuple_element<I, sprout::types::type_tuple<Types...> >
: public sprout::types::detail::tuple_element_impl<I, sprout::types::type_tuple<Types...> >
{};
} // namespace std

View file

@ -169,14 +169,14 @@ namespace sprout {
namespace tuples {
namespace detail {
template<std::size_t I, typename T>
struct tuple_element_impl;
class tuple_element_impl;
template<typename T1, typename T2>
struct tuple_element_impl<0, sprout::pair<T1, T2> > {
class tuple_element_impl<0, sprout::pair<T1, T2> > {
public:
typedef T1 type;
};
template<typename T1, typename T2>
struct tuple_element_impl<1, sprout::pair<T1, T2> > {
class tuple_element_impl<1, sprout::pair<T1, T2> > {
public:
typedef T2 type;
};
@ -189,7 +189,7 @@ namespace std {
// tuple_size
//
template<typename T1, typename T2>
struct tuple_size<sprout::pair<T1, T2> >
class tuple_size<sprout::pair<T1, T2> >
: public std::integral_constant<std::size_t, 2>
{};
@ -197,7 +197,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename T1, typename T2>
struct tuple_element<I, sprout::pair<T1, T2> >
class tuple_element<I, sprout::pair<T1, T2> >
: public sprout::tuples::detail::tuple_element_impl<I, sprout::pair<T1, T2> >
{};
} // namespace std

View file

@ -264,7 +264,7 @@ namespace std {
// tuple_size
//
template<>
struct tuple_size<sprout::uuids::uuid> {
class tuple_size<sprout::uuids::uuid> {
public:
typedef std::integral_constant<std::size_t, 16> type;
SPROUT_STATIC_CONSTEXPR std::size_t value = type::value;
@ -274,7 +274,7 @@ namespace std {
// tuple_element
//
template<std::size_t I>
struct tuple_element<I, sprout::uuids::uuid> {
class tuple_element<I, sprout::uuids::uuid> {
public:
static_assert(I < 16, "tuple_element<>: index out of range");
typedef sprout::uuids::uuid::value_type type;

View file

@ -266,7 +266,7 @@ namespace std {
// tuple_size
//
template<typename... Types>
struct tuple_size<sprout::variant<Types...> >
class tuple_size<sprout::variant<Types...> >
: public std::tuple_size<typename sprout::variant<Types...>::tuple_type>
{};
@ -274,7 +274,7 @@ namespace std {
// tuple_element
//
template<std::size_t I, typename... Types>
struct tuple_element<I, sprout::variant<Types...> >
class tuple_element<I, sprout::variant<Types...> >
: public std::tuple_element<I, typename sprout::variant<Types...>::tuple_type>
{};
} // namespace std

View file

@ -22,6 +22,11 @@ namespace sprout {
struct repeat_p
: public sprout::weed::parser_base
{
public:
template<typename Context, typename Iterator>
struct attribute;
template<typename Context, typename Iterator>
struct result;
private:
template<typename Context, typename Iterator>
struct eval {

View file

@ -1,6 +1,7 @@
#ifndef SPROUT_WEED_PARSER_NUMERIC_BIN_HPP
#define SPROUT_WEED_PARSER_NUMERIC_BIN_HPP
#include <cstddef>
#include <cstdint>
#include <sprout/config.hpp>
#include <sprout/integer/integer_digits.hpp>
@ -11,7 +12,7 @@ namespace sprout {
//
// bin
//
SPROUT_STATIC_CONSTEXPR auto bin = sprout::weed::uint_p<std::uintmax_t, 2, -1>();
SPROUT_STATIC_CONSTEXPR auto bin = sprout::weed::uint_p<std::uintmax_t, 2, static_cast<std::size_t>(-1)>();
//
// bin8

View file

@ -1,6 +1,7 @@
#ifndef SPROUT_WEED_PARSER_NUMERIC_HEX_HPP
#define SPROUT_WEED_PARSER_NUMERIC_HEX_HPP
#include <cstddef>
#include <cstdint>
#include <sprout/config.hpp>
#include <sprout/integer/integer_digits.hpp>
@ -11,7 +12,7 @@ namespace sprout {
//
// hex
//
SPROUT_STATIC_CONSTEXPR auto hex = sprout::weed::uint_p<std::uintmax_t, 16, -1>();
SPROUT_STATIC_CONSTEXPR auto hex = sprout::weed::uint_p<std::uintmax_t, 16, static_cast<std::size_t>(-1)>();
//
// hex8

View file

@ -1,6 +1,7 @@
#ifndef SPROUT_WEED_PARSER_NUMERIC_INT_HPP
#define SPROUT_WEED_PARSER_NUMERIC_INT_HPP
#include <cstddef>
#include <cstdint>
#include <sprout/config.hpp>
#include <sprout/integer/integer_digits.hpp>
@ -11,7 +12,7 @@ namespace sprout {
//
// int_
//
SPROUT_STATIC_CONSTEXPR auto int_ = sprout::weed::int_p<std::intmax_t, 10, 1, -1>();
SPROUT_STATIC_CONSTEXPR auto int_ = sprout::weed::int_p<std::intmax_t, 10, 1, static_cast<std::size_t>(-1)>();
//
// int8

View file

@ -1,6 +1,7 @@
#ifndef SPROUT_WEED_PARSER_NUMERIC_OCT_HPP
#define SPROUT_WEED_PARSER_NUMERIC_OCT_HPP
#include <cstddef>
#include <cstdint>
#include <sprout/config.hpp>
#include <sprout/integer/integer_digits.hpp>
@ -11,7 +12,7 @@ namespace sprout {
//
// oct
//
SPROUT_STATIC_CONSTEXPR auto oct = sprout::weed::uint_p<std::uintmax_t, 8, -1>();
SPROUT_STATIC_CONSTEXPR auto oct = sprout::weed::uint_p<std::uintmax_t, 8, static_cast<std::size_t>(-1)>();
//
// oct8

View file

@ -1,6 +1,7 @@
#ifndef SPROUT_WEED_PARSER_NUMERIC_UINT_HPP
#define SPROUT_WEED_PARSER_NUMERIC_UINT_HPP
#include <cstddef>
#include <cstdint>
#include <sprout/config.hpp>
#include <sprout/integer/integer_digits.hpp>
@ -11,7 +12,7 @@ namespace sprout {
//
// uint_
//
SPROUT_STATIC_CONSTEXPR auto uint_ = sprout::weed::uint_p<std::uintmax_t, 10, 1, -1>();
SPROUT_STATIC_CONSTEXPR auto uint_ = sprout::weed::uint_p<std::uintmax_t, 10, 1, static_cast<std::size_t>(-1)>();
//
// uint8

View file

@ -15,7 +15,7 @@ namespace sprout {
//
template<typename T, typename Iterator, typename Context, typename = void>
struct limit_of
: public std::integral_constant<std::size_t, -1>
: public std::integral_constant<std::size_t, static_cast<std::size_t>(-1)>
{};
template<typename T, typename Iterator, typename Context>
struct limit_of<T const, Iterator, Context>