diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index f07430121..0dc72fd6c 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -7,7 +7,7 @@ STRIP_FROM_PATH = @Boost.Hana_SOURCE_DIR@/include BUILTIN_STL_SUPPORT = YES STRIP_FROM_INC_PATH = @Boost.Hana_SOURCE_DIR@/include ALIASES = -ENABLED_SECTIONS = # BOOST_HANA_RATIONALES +ENABLED_SECTIONS = # Resources diff --git a/example/core/convert.cpp b/example/core/convert/convert.cpp similarity index 94% rename from example/core/convert.cpp rename to example/core/convert/convert.cpp index de6dccde1..fb0d973a6 100644 --- a/example/core/convert.cpp +++ b/example/core/convert/convert.cpp @@ -5,7 +5,8 @@ Distributed under the Boost Software License, Version 1.0. */ #include -#include +#include +#include #include #include diff --git a/example/list/to.cpp b/example/core/convert/to.cpp similarity index 100% rename from example/list/to.cpp rename to example/core/convert/to.cpp diff --git a/example/core/instantiates/instantiates.cpp b/example/core/instantiates/instantiates.cpp new file mode 100644 index 000000000..3550184fe --- /dev/null +++ b/example/core/instantiates/instantiates.cpp @@ -0,0 +1,21 @@ +/* +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#include +#include +#include +#include +#include +using namespace boost::hana; + + +int main() { + //! [main] + BOOST_HANA_STATIC_ASSERT(instantiates); + BOOST_HANA_STATIC_ASSERT(!instantiates); + BOOST_HANA_STATIC_ASSERT(!instantiates); + //! [main] +} diff --git a/example/core/is_a.cpp b/example/core/instantiates/is_a.cpp similarity index 97% rename from example/core/is_a.cpp rename to example/core/instantiates/is_a.cpp index 406ff1e5a..218c42a48 100644 --- a/example/core/is_a.cpp +++ b/example/core/instantiates/is_a.cpp @@ -5,7 +5,7 @@ Distributed under the Boost Software License, Version 1.0. */ #include -#include +#include #include #include #include diff --git a/example/core/typeclass/binary_typeclass.cpp b/example/core/typeclass/binary_typeclass.cpp new file mode 100644 index 000000000..14fcceb2b --- /dev/null +++ b/example/core/typeclass/binary_typeclass.cpp @@ -0,0 +1,64 @@ +/* +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +// Similar represents a relaxed equality. +struct Similar { + BOOST_HANA_BINARY_TYPECLASS(Similar); + struct mcd { }; + + // By default, two (seemingly) unrelated things are not similar. + template + struct default_instance : mcd { + template + static constexpr auto similar_impl(X x, Y y) + { return hana::false_; } + }; +}; + +// Return whether `x` and `y` are similar. +// Notice that we dispatch on both data types. +BOOST_HANA_CONSTEXPR_LAMBDA auto similar = [](auto x, auto y) { + return Similar::instance< + hana::datatype_t, + hana::datatype_t + >::similar_impl(x, y); +}; + +// Two STL containers are similar if they are std::equal +template +struct Similar::instance().begin()), + decltype((void)std::declval().begin()) +>> : Similar::mcd { + static constexpr auto similar_impl(X x, Y y) + { return std::equal(x.begin(), x.end(), y.begin(), y.end()); } +}; + +int main() { + std::vector foo_vec{'f', 'o', 'o'}; + std::string foo_str = "foo"; + + // We can now compare arbitrary containers + // (not that it's brilliant to do so) + assert(similar(foo_vec, foo_str)); + + // And arbitrary stuff now compare unequal. + BOOST_HANA_STATIC_ASSERT(!similar(1, foo_str)); +} diff --git a/example/core/default_instance.cpp b/example/core/typeclass/default_instance.cpp similarity index 92% rename from example/core/default_instance.cpp rename to example/core/typeclass/default_instance.cpp index aaac086a8..267ed96f4 100644 --- a/example/core/default_instance.cpp +++ b/example/core/typeclass/default_instance.cpp @@ -4,7 +4,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include #include #include diff --git a/example/core/disable.cpp b/example/core/typeclass/disable.cpp similarity index 88% rename from example/core/disable.cpp rename to example/core/typeclass/disable.cpp index 0123ee286..d0f47c8ab 100644 --- a/example/core/disable.cpp +++ b/example/core/typeclass/disable.cpp @@ -4,7 +4,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include #include #include #include diff --git a/example/core/typeclass.cpp b/example/core/typeclass/unary_typeclass.cpp similarity index 95% rename from example/core/typeclass.cpp rename to example/core/typeclass/unary_typeclass.cpp index 80a5d7689..9313aee1f 100644 --- a/example/core/typeclass.cpp +++ b/example/core/typeclass/unary_typeclass.cpp @@ -4,7 +4,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include #include #include diff --git a/example/core/typeclass/when.cpp b/example/core/typeclass/when.cpp new file mode 100644 index 000000000..ec18874d8 --- /dev/null +++ b/example/core/typeclass/when.cpp @@ -0,0 +1,32 @@ +/* +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#include +#include + +#include +#include +using namespace boost::hana; + + +struct Printable { + BOOST_HANA_TYPECLASS(Printable); +}; + +auto print = [](std::ostream& os, auto x) { + return Printable::instance>::print_impl(os, x); +}; + +template +struct Printable::instance::value>> { + static void print_impl(std::ostream& os, T x) { + os << x; + } +}; + +int main() { + print(std::cout, 2); +} diff --git a/example/core/typeclass/when_valid.cpp b/example/core/typeclass/when_valid.cpp new file mode 100644 index 000000000..7c073ba41 --- /dev/null +++ b/example/core/typeclass/when_valid.cpp @@ -0,0 +1,36 @@ +/* +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#include +#include + +#include +#include +#include +using namespace boost::hana; + + +struct Printable { + BOOST_HANA_TYPECLASS(Printable); +}; + +auto print = [](std::ostream& os, auto x) { + return Printable::instance>::print_impl(os, x); +}; + +template +struct Printable::instance() << std::declval()) +>> { + static void print_impl(std::ostream& os, T x) { + os << x; + } +}; + +int main() { + print(std::cout, 2); + print(std::cout, std::string{"foo"}); +} diff --git a/include/boost/hana.hpp b/include/boost/hana.hpp index af185a5d7..19a6b8d2c 100644 --- a/include/boost/hana.hpp +++ b/include/boost/hana.hpp @@ -655,10 +655,10 @@ are about to use it. ### Example of a type class definition -@include example/core/typeclass.cpp +@include example/core/typeclass/unary_typeclass.cpp ### Example of a type class with a default instance -@include example/core/default_instance.cpp +@include example/core/typeclass/default_instance.cpp @todo Document type classes with operators. @@ -845,6 +845,10 @@ can use all the methods it supports right away: @snippet example/tutorial/include_set.cpp main +@todo +Consider documenting the subdirectories of core/ one by one, if the current +separation sticks. + @section tutorial-mastering Mastering the library @@ -858,7 +862,7 @@ fit your needs better; go ahead, the library was intended to be used that way. The structure of the reference (available in the menu to the left) goes as follow: - - @ref core\n + - @ref group-core\n Documentation for the core module, which contains everything needed to implement type classes, data types and related utilities. This is relevant if you need to extend the library, but otherwise the tutorial pretty much diff --git a/include/boost/hana/applicative/applicative.hpp b/include/boost/hana/applicative/applicative.hpp index fbaf63d96..2587e810a 100644 --- a/include/boost/hana/applicative/applicative.hpp +++ b/include/boost/hana/applicative/applicative.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_APPLICATIVE_APPLICATIVE_HPP #define BOOST_HANA_APPLICATIVE_APPLICATIVE_HPP +#include +#include #include -#include #include #include diff --git a/include/boost/hana/comparable/comparable.hpp b/include/boost/hana/comparable/comparable.hpp index bc2edf1f4..8041759cb 100644 --- a/include/boost/hana/comparable/comparable.hpp +++ b/include/boost/hana/comparable/comparable.hpp @@ -10,9 +10,10 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_COMPARABLE_COMPARABLE_HPP #define BOOST_HANA_COMPARABLE_COMPARABLE_HPP +#include +#include #include #include -#include #include @@ -47,7 +48,7 @@ namespace boost { namespace hana { //! ### Example //! @snippet example/comparable/equal.cpp main //! - //! @if BOOST_HANA_RATIONALES + //! @internal //! ### Rationale for the arity of `equal` //! It is a valid question whether `equal` should accept more than 2 //! arguments and have semantics matching those of Python's `==`. This @@ -59,7 +60,7 @@ namespace boost { namespace hana { //! - Having a binary `equal` makes it possible to use currying. //! - `equal(x, y...)` can be implemented as `all(x == _, list(y...))`, //! which is pretty straightforward anyway. - //! @endif + //! @endinternal BOOST_HANA_CONSTEXPR_LAMBDA auto equal = [](auto x, auto y) { return Comparable::instance< datatype_t, datatype_t diff --git a/include/boost/hana/constant/constant.hpp b/include/boost/hana/constant/constant.hpp index e6b36bc2e..747ca56e4 100644 --- a/include/boost/hana/constant/constant.hpp +++ b/include/boost/hana/constant/constant.hpp @@ -10,7 +10,8 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_CONSTANT_CONSTANT_HPP #define BOOST_HANA_CONSTANT_CONSTANT_HPP -#include +#include +#include namespace boost { namespace hana { diff --git a/include/boost/hana/constant/mcd.hpp b/include/boost/hana/constant/mcd.hpp index f444bc525..219ef8277 100644 --- a/include/boost/hana/constant/mcd.hpp +++ b/include/boost/hana/constant/mcd.hpp @@ -13,7 +13,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include diff --git a/include/boost/hana/core.hpp b/include/boost/hana/core.hpp index fd6398a42..585037b72 100644 --- a/include/boost/hana/core.hpp +++ b/include/boost/hana/core.hpp @@ -1,6 +1,6 @@ /*! @file -Defines the @ref core module. +Defines the @ref group-core module. @copyright Louis Dionne 2014 Distributed under the Boost Software License, Version 1.0. @@ -10,125 +10,12 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_CORE_HPP #define BOOST_HANA_CORE_HPP -#include -#include +//! @defgroup group-core Core +//! Core utilities of the library. - -namespace boost { namespace hana { - //! @defgroup core Core - //! Miscellaneous core utilities. - - namespace core_detail { - constexpr auto instantiates_impl(...) { return true_; } - constexpr auto instantiates_impl(disable*) { return false_; } - } - - //! @ingroup core - //! Whether the type class is instantiated with the given arguments. - //! @hideinitializer - //! - //! This is provided in addition to `is_a` for type classes taking more - //! than one argument or when no object of the data type is available. - template - constexpr auto instantiates = core_detail::instantiates_impl( - (typename Typeclass::template instance*)0 - ); - - namespace core_detail { - template - struct is_a { - template - constexpr auto operator()(X x) const - { return instantiates>; } - }; - } - - //! @ingroup core - //! Return whether an object is an instance of the given type class. - //! - //! ### Example - //! @snippet example/core/is_a.cpp main - template - constexpr core_detail::is_a is_a{}; - - //! @ingroup core - //! Equivalent to `is_a`; provided for consistency with the rules of the - //! English language. - template - constexpr core_detail::is_a is_an{}; - - namespace core_detail { - template - struct default_convert { - template - static constexpr auto apply_impl(X x, int) - -> decltype(static_cast(x)) - { return static_cast(x); } - - template - static constexpr auto apply_impl(X x, ...) { - static_assert((sizeof(X), false), - "there exists no conversion between the given data types"); - } - - template - static constexpr auto apply(X x) - { return apply_impl(x, int{0}); } - }; - - template - struct default_convert { - template - static constexpr auto apply(X x) { return x; } - }; - } - - //! @ingroup core - //! Implements conversions between data types. - //! - //! To specify a conversion between two data types, one must specialize - //! `convert` for the corresponding data types. A dummy template parameter - //! is also provided for SFINAE. This allows conversions to be specified - //! for all data types satisfying a predicate. - //! - //! By default, `convert` has the following behavior: - //! If the `To` and `From` data types are the same, nothing is done. - //! Otherwise, if the type of the converted-from object -- its actual - //! type, not its data type -- is convertible to the `To` data type with - //! `static_cast`, that conversion is used. Otherwise, a static assertion - //! is triggered. - //! - //! @note - //! `convert` is only used to provide the conversions; to actually - //! perform conversions, use `to`. - //! - //! ### Example - //! @include example/core/convert.cpp - template - struct convert - : core_detail::default_convert - { }; - - namespace core_detail { - template - struct to { - template - constexpr auto operator()(X x) const - { return convert>::apply(x); } - }; - } - - //! @ingroup core - //! Create an object of a data type from an object of another data type. - //! - //! See `convert` for how to specify user-defined conversions. - //! - //! ### Example - //! @snippet example/list/to.cpp main - template - constexpr core_detail::to to{}; -}} // end namespace boost::hana +#include +#include +#include +#include #endif // !BOOST_HANA_CORE_HPP - -#include diff --git a/include/boost/hana/core/convert.hpp b/include/boost/hana/core/convert.hpp new file mode 100644 index 000000000..cc7787718 --- /dev/null +++ b/include/boost/hana/core/convert.hpp @@ -0,0 +1,104 @@ +/*! +@file +Defines `boost::hana::convert` and `boost::hana::to`. + +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_HANA_CORE_CONVERT_HPP +#define BOOST_HANA_CORE_CONVERT_HPP + +#include + + +namespace boost { namespace hana { + namespace core_detail { + template + struct default_convert { + template + static constexpr auto apply_impl(X x, int) + -> decltype(static_cast(x)) + { return static_cast(x); } + + template + static constexpr auto apply_impl(X x, ...) { + static_assert((sizeof(X), false), + "there exists no conversion between the given data types"); + } + + template + static constexpr auto apply(X x) + { return apply_impl(x, int{0}); } + }; + + template + struct default_convert { + template + static constexpr auto apply(X x) { return x; } + }; + } + + //! @ingroup group-core + //! Implements conversions between data types. + //! + //! To specify a conversion between two data types, one must specialize + //! `convert` for the corresponding data types. A dummy template parameter + //! is also provided for SFINAE. This allows conversions to be specified + //! for all data types satisfying a predicate. + //! + //! By default, `convert` has the following behavior: + //! If the `To` and `From` data types are the same, nothing is done. + //! Otherwise, if the type of the converted-from object -- its actual + //! type, not its data type -- is convertible to the `To` data type with + //! `static_cast`, that conversion is used. Otherwise, a static assertion + //! is triggered. + //! + //! @note + //! `convert` is only used to provide the conversions; to actually + //! perform conversions, use `to`. + //! + //! ### Example + //! @include example/core/convert/convert.cpp + template + struct convert + : core_detail::default_convert + { }; + + namespace core_detail { + template + struct to { + template + constexpr auto operator()(X x) const + { return convert>::apply(x); } + }; + } + + //! @ingroup group-core + //! Create an object of a data type from an object of another data type. + //! + //! See `convert` to specify _how_ to convert from a data type to another. + //! + //! + //! @tparam To + //! The data type to which `x` should be converted. + //! + //! @param x + //! The object to convert to the given data type. + //! + //! + //! ### Example + //! @snippet example/core/convert/to.cpp main +#ifdef BOOST_HANA_DOXYGEN_INVOKED + template + constexpr auto to = [](auto x) { + return convert>::apply(x); + }; +#else + template + constexpr core_detail::to to{}; +#endif +}} // end namespace boost::hana + +#endif // !BOOST_HANA_CORE_CONVERT_HPP diff --git a/include/boost/hana/core/datatype.hpp b/include/boost/hana/core/datatype.hpp new file mode 100644 index 000000000..a4d14bbd2 --- /dev/null +++ b/include/boost/hana/core/datatype.hpp @@ -0,0 +1,52 @@ +/*! +@file +Defines `boost::hana::datatype` and `boost::hana::datatype_t`. + +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_HANA_CORE_DATATYPE_HPP +#define BOOST_HANA_CORE_DATATYPE_HPP + +namespace boost { namespace hana { + namespace core_detail { + template + struct default_datatype { using type = T; }; + + template + struct default_datatype { + using type = typename T::hana_datatype; + }; + } + + //! @ingroup group-core + //! Metafunction returning the data type associated to `T`. + //! + //! By default, this metafunction returns `T::hana_datatype` if that + //! expression is valid, and `T` otherwise. It can also be specialized + //! to customize the data type of `T` without requiring `T` to have a + //! nested `hana_datatype` type. A dummy parameter is also provided to + //! allow `datatype` to be specialized for all types satisfying a predicate + //! using `std::enable_if`. + //! + //! @todo + //! - Could this be related to `decltype_`? If so, how? It is a valid + //! question whether `decltype_(list(...))` should be `List` or ``. + //! - Consider using two layers of specializations to improve performance + //! if this is an issue. I suspect that using the enabler will hurt + //! performance a lot because it requires the compiler to look at all + //! the enablers each time `datatype` is instantiated. + template + struct datatype { + using type = typename core_detail::default_datatype::type; + }; + + //! @ingroup group-core + //! Alias to `datatype::%type`. + template + using datatype_t = typename datatype::type; +}} // end namespace boost::hana + +#endif // !BOOST_HANA_CORE_DATATYPE_HPP diff --git a/include/boost/hana/core/instantiates.hpp b/include/boost/hana/core/instantiates.hpp new file mode 100644 index 000000000..fc02275df --- /dev/null +++ b/include/boost/hana/core/instantiates.hpp @@ -0,0 +1,84 @@ +/*! +@file +Defines `boost::hana::instantiates`, `boost::hana::is_a` and `boost::hana::is_an`. + +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_HANA_CORE_INSTANTIATES_HPP +#define BOOST_HANA_CORE_INSTANTIATES_HPP + +#include +#include // for disable +#include + + +namespace boost { namespace hana { + namespace core_detail { + constexpr auto instantiates_impl(...) { return true_; } + constexpr auto instantiates_impl(disable*) { return false_; } + } + + //! @ingroup group-core + //! Variable template representing whether the type class is instantiated + //! with the given arguments. + //! + //! Specifically, `instantiates` is a + //! [compile-time](@ref Logical_terminology) `Logical` representing + //! whether `Typeclass::instance` represents an instance + //! of `Typeclass`. This does not check whether the instance is valid: + //! it does not check whether laws are satisfied or even if the minimal + //! complete definition is syntactically correct. It only tells whether + //! an instance is there and was not disabled explicitly with `disable`. + //! + //! This is provided in addition to `is_a` for type classes taking more + //! than one argument or when no object of the data type is available. + //! + //! ### Example + //! @snippet example/core/instantiates/instantiates.cpp main +#ifdef BOOST_HANA_DOXYGEN_INVOKED + template + constexpr auto instantiates = unspecified; +#else + template + constexpr auto instantiates = core_detail::instantiates_impl( + (typename Typeclass::template instance*)0 + ); +#endif + + namespace core_detail { + template + struct is_a { + template + constexpr auto operator()(X x) const + { return instantiates>; } + }; + } + + //! @ingroup group-core + //! Return whether an object is an instance of the given type class. + //! + //! ### Example + //! @snippet example/core/instantiates/is_a.cpp main +#ifdef BOOST_HANA_DOXYGEN_INVOKED + template + constexpr auto is_a = [](auto x) { + return instantiates>; + }; +#else + template + constexpr core_detail::is_a is_a{}; +#endif + + //! @ingroup group-core + //! Equivalent to `is_a`; provided for consistency with the rules of the + //! English language. + template + constexpr auto is_an = is_a; +}} // end namespace boost::hana + +#endif // !BOOST_HANA_CORE_INSTANTIATES_HPP + +#include diff --git a/include/boost/hana/detail/typeclasses.hpp b/include/boost/hana/core/typeclass.hpp similarity index 63% rename from include/boost/hana/detail/typeclasses.hpp rename to include/boost/hana/core/typeclass.hpp index 40ad05d64..9588af31b 100644 --- a/include/boost/hana/detail/typeclasses.hpp +++ b/include/boost/hana/core/typeclass.hpp @@ -1,14 +1,14 @@ /*! @file -Internal header to break circular dependencies. +Defines utilities to create type classes. @copyright Louis Dionne 2014 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#ifndef BOOST_HANA_DETAIL_TYPECLASSES_HPP -#define BOOST_HANA_DETAIL_TYPECLASSES_HPP +#ifndef BOOST_HANA_CORE_TYPECLASS_HPP +#define BOOST_HANA_CORE_TYPECLASS_HPP namespace boost { namespace hana { struct disable; @@ -28,14 +28,15 @@ namespace boost { namespace hana { }; } - //! @ingroup core - //! Defines a unary type class + //! @ingroup group-core + //! Defines a unary type class. + //! @hideinitializer //! //! Use this macro at public scope when defining a type class to create //! the boilerplate necessary for a unary type class. //! //! ### Example - //! @include example/core/typeclass.cpp + //! @include example/core/typeclass/unary_typeclass.cpp #define BOOST_HANA_TYPECLASS(NAME) \ /** @cond */ \ template \ @@ -52,11 +53,17 @@ namespace boost { namespace hana { /** @endcond */ \ /**/ - //! @ingroup core - //! Defines a binary type class + //! @ingroup group-core + //! Defines a binary type class. + //! @hideinitializer //! //! This is equivalent to `BOOST_HANA_TYPECLASS`, except it creates a - //! type class with two arguments. + //! type class accepting two data types. This is useful for type classes + //! like `Comparable`, whose methods are binary and should be dispatched + //! using the data types of both arguments. + //! + //! ### Example + //! @include example/core/typeclass/binary_typeclass.cpp #define BOOST_HANA_BINARY_TYPECLASS(NAME) \ /** @cond */ \ template \ @@ -73,35 +80,39 @@ namespace boost { namespace hana { /** @endcond */ \ /**/ - //! @ingroup core - //! Used to instantiate a type class based on the value of a predicate. - //! - //! @note - //! `when` is provided whenever the header of a type class is included; - //! including boost/hana/core.hpp is not necessary in that case. + //! @ingroup group-core + //! Enable a type class instance only if a boolean condition is true. //! //! @internal - //! Using `when` is necessary for two reasons. First, a non-type - //! template argument may not depend on a template parameter of a - //! partial specialization, so we need to wrap the `bool` result of - //! the predicate into a type. Second, `when` is used to implement the - //! priority of partially specialized instances over predicated instances, - //! but we could also achieve the same by replacing `when` with - //! `void` and letting people use `enable_if`. + //! ### Rationale for using `when` instead of `std::enable_if` + //! Using `when` is necessary for two reasons. First, a non-type template + //! argument may not depend on a template parameter of a partial + //! specialization, so we need to wrap the `bool` condition into a type. + //! Second, `when` is used to implement the priority of partially + //! specialized instances over predicated instances, but we could also + //! achieve the same by replacing `when` with `void` and letting + //! people use `enable_if`. Hence, I'd say it boils down to preference + //! at this point; I'm open for discussion about this. + //! @endinternal + //! + //! ### Example + //! @include example/core/typeclass/when.cpp template struct when { }; - //! @ingroup core - //! Used to instantiate a type class based on the validity of - //! an expression. + //! @ingroup group-core + //! Enable a type class instance only if an expression is well-formed. //! //! Specifically, this is equivalent to `when`, but SFINAE will //! cause the partial specialization to fail when the expression is //! ill-formed. + //! + //! ### Example + //! @include example/core/typeclass/when_valid.cpp template using when_valid = when; - //! @ingroup core + //! @ingroup group-core //! Explicitly disable a type class instance. //! //! This is meant as a way to disable a type class instance provided @@ -109,48 +120,11 @@ namespace boost { namespace hana { //! a given data type. //! //! ### Example - //! @include example/core/disable.cpp + //! @include example/core/typeclass/disable.cpp struct disable { }; - namespace core_detail { - template - struct default_datatype { using type = T; }; - - template - struct default_datatype { - using type = typename T::hana_datatype; - }; - } - - //! @ingroup core - //! Metafunction returning the data type associated to `T`. - //! - //! By default, this metafunction returns `T::hana_datatype` if that - //! expression is valid, and `T` otherwise. It can also be specialized - //! to customize the data type of `T` without requiring `T` to have a - //! nested `hana_datatype` type. A dummy parameter is also provided to - //! allow `datatype` to be specialized for all types satisfying a predicate - //! using `std::enable_if`. - //! - //! @todo - //! - Could this be related to `decltype_`? If so, how? It is a valid - //! question whether `decltype_(list(...))` should be `List` or ``. - //! - Consider using two layers of specializations to improve performance - //! if this is an issue. I suspect that using the enabler will hurt - //! performance a lot because it requires the compiler to look at all - //! the enablers each time `datatype` is instantiated. - template - struct datatype { - using type = typename core_detail::default_datatype::type; - }; - - //! @ingroup core - //! Alias to `datatype::%type`. - template - using datatype_t = typename datatype::type; - namespace operators { - //! @ingroup core + //! @ingroup group-core //! Allows operators in the `boost::hana::operators` namespace to be //! found by ADL. //! @@ -159,10 +133,6 @@ namespace boost { namespace hana { //! for a type. //! //! @note - //! boost/hana/core.hpp does not need to be included when the header - //! of a type class providing operators has been included. - //! - //! @note //! Nothing except operators should be defined in this namespace; //! otherwise, ambiguities can arise when `using namespace operators`. //! @@ -185,4 +155,4 @@ namespace boost { namespace hana { } }} // end namespace boost::hana -#endif // !BOOST_HANA_DETAIL_TYPECLASSES_HPP +#endif // !BOOST_HANA_CORE_TYPECLASS_HPP diff --git a/include/boost/hana/detail/bool_fwd.hpp b/include/boost/hana/detail/bool_fwd.hpp new file mode 100644 index 000000000..2d0a3eba2 --- /dev/null +++ b/include/boost/hana/detail/bool_fwd.hpp @@ -0,0 +1,15 @@ +/*! +@file +Internal header to break cyclic dependencies. + +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_HANA_DETAIL_BOOL_FWD_HPP +#define BOOST_HANA_DETAIL_BOOL_FWD_HPP + +#include + +#endif // !BOOST_HANA_DETAIL_BOOL_FWD_HPP diff --git a/include/boost/hana/detail/integral_fwd.hpp b/include/boost/hana/detail/integral_fwd.hpp index 5a9db333a..8ee9ddedc 100644 --- a/include/boost/hana/detail/integral_fwd.hpp +++ b/include/boost/hana/detail/integral_fwd.hpp @@ -10,9 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_DETAIL_INTEGRAL_FWD_HPP #define BOOST_HANA_DETAIL_INTEGRAL_FWD_HPP +#include // for operators::enable #include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/detail/minimal/iterable.hpp b/include/boost/hana/detail/minimal/iterable.hpp index eb5809326..047e6b2eb 100644 --- a/include/boost/hana/detail/minimal/iterable.hpp +++ b/include/boost/hana/detail/minimal/iterable.hpp @@ -12,7 +12,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include #include diff --git a/include/boost/hana/detail/sandbox/boolean.hpp b/include/boost/hana/detail/sandbox/boolean.hpp index d83fdce5d..f8decdaa6 100644 --- a/include/boost/hana/detail/sandbox/boolean.hpp +++ b/include/boost/hana/detail/sandbox/boolean.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_BOOLEAN_HPP #define BOOST_HANA_BOOLEAN_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/detail/sandbox/monad_zero.hpp b/include/boost/hana/detail/sandbox/monad_zero.hpp index 8330e442b..bc7113d9c 100644 --- a/include/boost/hana/detail/sandbox/monad_zero.hpp +++ b/include/boost/hana/detail/sandbox/monad_zero.hpp @@ -11,8 +11,9 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_MONAD_ZERO_HPP #include +#include +#include #include -#include #include #include diff --git a/include/boost/hana/detail/sandbox/pattern.hpp b/include/boost/hana/detail/sandbox/pattern.hpp index c1c396225..732fccdc0 100644 --- a/include/boost/hana/detail/sandbox/pattern.hpp +++ b/include/boost/hana/detail/sandbox/pattern.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_PATTERN_HPP #define BOOST_HANA_PATTERN_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/ext/boost/fusion.hpp b/include/boost/hana/ext/boost/fusion.hpp index 3d192976b..44d483430 100644 --- a/include/boost/hana/ext/boost/fusion.hpp +++ b/include/boost/hana/ext/boost/fusion.hpp @@ -11,7 +11,7 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_EXT_BOOST_FUSION_VECTOR_HPP #include -#include +#include #include #include #include diff --git a/include/boost/hana/ext/boost/mpl/list.hpp b/include/boost/hana/ext/boost/mpl/list.hpp index 192c38ea0..24d7af6b2 100644 --- a/include/boost/hana/ext/boost/mpl/list.hpp +++ b/include/boost/hana/ext/boost/mpl/list.hpp @@ -12,7 +12,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include #include #include diff --git a/include/boost/hana/ext/boost/mpl/vector.hpp b/include/boost/hana/ext/boost/mpl/vector.hpp index 718bc6b3b..869904839 100644 --- a/include/boost/hana/ext/boost/mpl/vector.hpp +++ b/include/boost/hana/ext/boost/mpl/vector.hpp @@ -12,11 +12,11 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include #include #include -#include //! @todo remove this +#include #include #include @@ -47,7 +47,8 @@ namespace boost { namespace hana { //! @snippet example/ext/boost/mpl/vector/cheatsheet/fold.cpp hana //! //! @todo - //! Finish the cheat sheet. + //! - Finish the cheat sheet. + //! - Remove the list/instance.hpp include #ifdef BOOST_HANA_DOXYGEN_INVOKED struct MplVector { }; #else diff --git a/include/boost/hana/ext/boost/tuple.hpp b/include/boost/hana/ext/boost/tuple.hpp index 47e5fab3c..a6fbc60dc 100644 --- a/include/boost/hana/ext/boost/tuple.hpp +++ b/include/boost/hana/ext/boost/tuple.hpp @@ -11,7 +11,7 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_EXT_BOOST_TUPLE_HPP #include -#include +#include #include #include diff --git a/include/boost/hana/ext/std/array.hpp b/include/boost/hana/ext/std/array.hpp index f2c797c28..53befbea0 100644 --- a/include/boost/hana/ext/std/array.hpp +++ b/include/boost/hana/ext/std/array.hpp @@ -11,7 +11,7 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_EXT_STD_ARRAY_HPP #include -#include +#include #include #include #include diff --git a/include/boost/hana/ext/std/integer_sequence.hpp b/include/boost/hana/ext/std/integer_sequence.hpp index 8167f3948..85b5e4924 100644 --- a/include/boost/hana/ext/std/integer_sequence.hpp +++ b/include/boost/hana/ext/std/integer_sequence.hpp @@ -12,7 +12,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include #include diff --git a/include/boost/hana/ext/std/integral_constant.hpp b/include/boost/hana/ext/std/integral_constant.hpp index 9c37ae4a2..b2b93b34f 100644 --- a/include/boost/hana/ext/std/integral_constant.hpp +++ b/include/boost/hana/ext/std/integral_constant.hpp @@ -10,7 +10,7 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_EXT_STD_INTEGRAL_CONSTANT_HPP #define BOOST_HANA_EXT_STD_INTEGRAL_CONSTANT_HPP -#include +#include #include #include diff --git a/include/boost/hana/ext/std/list.hpp b/include/boost/hana/ext/std/list.hpp index 88efe336a..ede63beb1 100644 --- a/include/boost/hana/ext/std/list.hpp +++ b/include/boost/hana/ext/std/list.hpp @@ -10,7 +10,7 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_EXT_STD_LIST_HPP #define BOOST_HANA_EXT_STD_LIST_HPP -#include +#include #include #include diff --git a/include/boost/hana/ext/std/pair.hpp b/include/boost/hana/ext/std/pair.hpp index 7d63e0d9b..8593a0483 100644 --- a/include/boost/hana/ext/std/pair.hpp +++ b/include/boost/hana/ext/std/pair.hpp @@ -10,7 +10,7 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_EXT_STD_PAIR_HPP #define BOOST_HANA_EXT_STD_PAIR_HPP -#include +#include #include #include diff --git a/include/boost/hana/ext/std/tuple.hpp b/include/boost/hana/ext/std/tuple.hpp index d621dc363..06aa53635 100644 --- a/include/boost/hana/ext/std/tuple.hpp +++ b/include/boost/hana/ext/std/tuple.hpp @@ -12,7 +12,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include #include #include diff --git a/include/boost/hana/foldable/foldable.hpp b/include/boost/hana/foldable/foldable.hpp index b9c372910..7ee6c4287 100644 --- a/include/boost/hana/foldable/foldable.hpp +++ b/include/boost/hana/foldable/foldable.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_FOLDABLE_FOLDABLE_HPP #define BOOST_HANA_FOLDABLE_FOLDABLE_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/functor/functor.hpp b/include/boost/hana/functor/functor.hpp index 676f877ec..441300143 100644 --- a/include/boost/hana/functor/functor.hpp +++ b/include/boost/hana/functor/functor.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_FUNCTOR_FUNCTOR_HPP #define BOOST_HANA_FUNCTOR_FUNCTOR_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/iterable/iterable.hpp b/include/boost/hana/iterable/iterable.hpp index e6fe78117..0b9f03544 100644 --- a/include/boost/hana/iterable/iterable.hpp +++ b/include/boost/hana/iterable/iterable.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_ITERABLE_ITERABLE_HPP #define BOOST_HANA_ITERABLE_ITERABLE_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/iterable/mcd.hpp b/include/boost/hana/iterable/mcd.hpp index 63fda1308..c260d2cd1 100644 --- a/include/boost/hana/iterable/mcd.hpp +++ b/include/boost/hana/iterable/mcd.hpp @@ -13,7 +13,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include // for instantiates +#include #include #include #include diff --git a/include/boost/hana/list/list.hpp b/include/boost/hana/list/list.hpp index 140eadccb..13c9037ec 100644 --- a/include/boost/hana/list/list.hpp +++ b/include/boost/hana/list/list.hpp @@ -10,9 +10,10 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_LIST_LIST_HPP #define BOOST_HANA_LIST_LIST_HPP +#include +#include #include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/list/mcd.hpp b/include/boost/hana/list/mcd.hpp index 9cca5b1ad..a4b77772e 100644 --- a/include/boost/hana/list/mcd.hpp +++ b/include/boost/hana/list/mcd.hpp @@ -14,7 +14,8 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include // for instantiates and convert +#include +#include #include #include #include diff --git a/include/boost/hana/logical/logical.hpp b/include/boost/hana/logical/logical.hpp index dbf392185..03542f6e6 100644 --- a/include/boost/hana/logical/logical.hpp +++ b/include/boost/hana/logical/logical.hpp @@ -10,9 +10,10 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_LOGICAL_LOGICAL_HPP #define BOOST_HANA_LOGICAL_LOGICAL_HPP +#include +#include #include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/map.hpp b/include/boost/hana/map.hpp index de3d751c9..8de2e169d 100644 --- a/include/boost/hana/map.hpp +++ b/include/boost/hana/map.hpp @@ -11,7 +11,8 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_MAP_HPP #include -#include +#include +#include #include #include #include diff --git a/include/boost/hana/monad/laws.hpp b/include/boost/hana/monad/laws.hpp index 90ab1c24c..09ad74e7b 100644 --- a/include/boost/hana/monad/laws.hpp +++ b/include/boost/hana/monad/laws.hpp @@ -14,7 +14,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include #include #include #include diff --git a/include/boost/hana/monad/monad.hpp b/include/boost/hana/monad/monad.hpp index 4ddb1d7f5..5b566c3ec 100644 --- a/include/boost/hana/monad/monad.hpp +++ b/include/boost/hana/monad/monad.hpp @@ -11,8 +11,9 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_MONAD_MONAD_HPP #include +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/orderable/orderable.hpp b/include/boost/hana/orderable/orderable.hpp index 20920332c..472a9b775 100644 --- a/include/boost/hana/orderable/orderable.hpp +++ b/include/boost/hana/orderable/orderable.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_ORDERABLE_ORDERABLE_HPP #define BOOST_HANA_ORDERABLE_ORDERABLE_HPP +#include +#include #include -#include #include diff --git a/include/boost/hana/product/mcd.hpp b/include/boost/hana/product/mcd.hpp index 00cdb3ebf..293d5da8d 100644 --- a/include/boost/hana/product/mcd.hpp +++ b/include/boost/hana/product/mcd.hpp @@ -13,7 +13,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include // for instantiates +#include #include diff --git a/include/boost/hana/product/product.hpp b/include/boost/hana/product/product.hpp index 019ac78e8..95b1fabae 100644 --- a/include/boost/hana/product/product.hpp +++ b/include/boost/hana/product/product.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_PRODUCT_PRODUCT_HPP #define BOOST_HANA_PRODUCT_PRODUCT_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/record/mcd.hpp b/include/boost/hana/record/mcd.hpp index a34fcc7b3..073558e3f 100644 --- a/include/boost/hana/record/mcd.hpp +++ b/include/boost/hana/record/mcd.hpp @@ -13,7 +13,8 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include // for instantiates and datatype_t +#include +#include #include #include #include diff --git a/include/boost/hana/record/record.hpp b/include/boost/hana/record/record.hpp index b84449309..1b892a9b3 100644 --- a/include/boost/hana/record/record.hpp +++ b/include/boost/hana/record/record.hpp @@ -10,8 +10,8 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_RECORD_RECORD_HPP #define BOOST_HANA_RECORD_RECORD_HPP +#include #include -#include namespace boost { namespace hana { @@ -38,7 +38,9 @@ namespace boost { namespace hana { //! by the key `k` can be accessed by calling the function `f` on an object //! of data type `R`. template - BOOST_HANA_CONSTEXPR_LAMBDA auto members = Record::instance::members_impl(); + BOOST_HANA_CONSTEXPR_LAMBDA auto members = Record::instance< + R + >::members_impl(); }} // end namespace boost::hana #endif // !BOOST_HANA_RECORD_RECORD_HPP diff --git a/include/boost/hana/searchable/searchable.hpp b/include/boost/hana/searchable/searchable.hpp index 01b08957a..f0e33e25b 100644 --- a/include/boost/hana/searchable/searchable.hpp +++ b/include/boost/hana/searchable/searchable.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_SEARCHABLE_SEARCHABLE_HPP #define BOOST_HANA_SEARCHABLE_SEARCHABLE_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/set.hpp b/include/boost/hana/set.hpp index 3dd4ec035..01e0d7c20 100644 --- a/include/boost/hana/set.hpp +++ b/include/boost/hana/set.hpp @@ -11,7 +11,8 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_HANA_SET_HPP #include -#include +#include +#include #include #include #include diff --git a/include/boost/hana/traversable/traversable.hpp b/include/boost/hana/traversable/traversable.hpp index dca02e413..c38fadb9c 100644 --- a/include/boost/hana/traversable/traversable.hpp +++ b/include/boost/hana/traversable/traversable.hpp @@ -10,8 +10,9 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_HANA_TRAVERSABLE_TRAVERSABLE_HPP #define BOOST_HANA_TRAVERSABLE_TRAVERSABLE_HPP +#include +#include #include -#include namespace boost { namespace hana { diff --git a/include/boost/hana/type.hpp b/include/boost/hana/type.hpp index 1bb0988b8..e7f5fcd76 100644 --- a/include/boost/hana/type.hpp +++ b/include/boost/hana/type.hpp @@ -12,7 +12,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include -#include +#include // for operators::enable #include diff --git a/test/comparable/defaults.cpp b/test/comparable/defaults.cpp index e8ecc228c..cb2910913 100644 --- a/test/comparable/defaults.cpp +++ b/test/comparable/defaults.cpp @@ -6,7 +6,8 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include +#include #include using namespace boost::hana; diff --git a/test/core/bugs/clang_assert_vtemplate_lambda.cpp b/test/core/bugs/clang_assert_vtemplate_lambda.cpp index c32a72f29..4d6805184 100644 --- a/test/core/bugs/clang_assert_vtemplate_lambda.cpp +++ b/test/core/bugs/clang_assert_vtemplate_lambda.cpp @@ -4,7 +4,9 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include +#include using namespace boost::hana; diff --git a/test/core/convert/default.cpp b/test/core/convert/default.cpp index 4d304402a..b60b9ba24 100644 --- a/test/core/convert/default.cpp +++ b/test/core/convert/default.cpp @@ -4,7 +4,7 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include #include diff --git a/test/core/convert/specialize.cpp b/test/core/convert/specialize.cpp index 603ce832e..f0c0e8301 100644 --- a/test/core/convert/specialize.cpp +++ b/test/core/convert/specialize.cpp @@ -4,7 +4,7 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include #include #include diff --git a/test/core/datatype.cpp b/test/core/datatype.cpp index 496f1f521..43385a5a0 100644 --- a/test/core/datatype.cpp +++ b/test/core/datatype.cpp @@ -4,7 +4,7 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include #include using namespace boost::hana; diff --git a/test/core/disable.cpp b/test/core/disable.cpp index cfdc624c2..a7d0d1c75 100644 --- a/test/core/disable.cpp +++ b/test/core/disable.cpp @@ -4,7 +4,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include #include using namespace boost::hana; diff --git a/test/core/instantiates.cpp b/test/core/instantiates.cpp index 0a8a9280c..6857810af 100644 --- a/test/core/instantiates.cpp +++ b/test/core/instantiates.cpp @@ -4,7 +4,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include #include diff --git a/test/core/is_a.cpp b/test/core/is_a.cpp index fd41d36fa..5acc31ca3 100644 --- a/test/core/is_a.cpp +++ b/test/core/is_a.cpp @@ -4,7 +4,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include +#include #include #include diff --git a/test/core/typeclass/parametric_datatype_and_predicate.cpp b/test/core/typeclass/parametric_datatype_and_predicate.cpp index 78ddc82f8..50516049e 100644 --- a/test/core/typeclass/parametric_datatype_and_predicate.cpp +++ b/test/core/typeclass/parametric_datatype_and_predicate.cpp @@ -4,7 +4,7 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include namespace hana = boost::hana; diff --git a/test/core/typeclass_resolution.cpp b/test/core/typeclass_resolution.cpp index 2419245bd..9181c915a 100644 --- a/test/core/typeclass_resolution.cpp +++ b/test/core/typeclass_resolution.cpp @@ -4,7 +4,7 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include #include using namespace boost::hana; diff --git a/test/detail/wrap.cpp b/test/detail/wrap.cpp index ab5442ed3..55e388c8f 100644 --- a/test/detail/wrap.cpp +++ b/test/detail/wrap.cpp @@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include #include #include diff --git a/test/ext/boost/fusion/datatype.cpp b/test/ext/boost/fusion/datatype.cpp index 4e0dd952f..41f7f4b9c 100644 --- a/test/ext/boost/fusion/datatype.cpp +++ b/test/ext/boost/fusion/datatype.cpp @@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include #include "helper.hpp" #include diff --git a/test/ext/boost/mpl/list/datatype.cpp b/test/ext/boost/mpl/list/datatype.cpp index 0ed05cdb0..14bf5cc98 100644 --- a/test/ext/boost/mpl/list/datatype.cpp +++ b/test/ext/boost/mpl/list/datatype.cpp @@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include #include #include diff --git a/test/ext/boost/mpl/vector/datatype.cpp b/test/ext/boost/mpl/vector/datatype.cpp index 0f00156b2..aea893a7a 100644 --- a/test/ext/boost/mpl/vector/datatype.cpp +++ b/test/ext/boost/mpl/vector/datatype.cpp @@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include #include #include diff --git a/test/ext/boost/tuple/datatype.cpp b/test/ext/boost/tuple/datatype.cpp index 7f63e802e..19a95543e 100644 --- a/test/ext/boost/tuple/datatype.cpp +++ b/test/ext/boost/tuple/datatype.cpp @@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include #include #include diff --git a/test/ext/std/integral_constant/bug_datatype_inheritance.cpp b/test/ext/std/integral_constant/bug_datatype_inheritance.cpp index 3ad94c21c..ddb1bc6b5 100644 --- a/test/ext/std/integral_constant/bug_datatype_inheritance.cpp +++ b/test/ext/std/integral_constant/bug_datatype_inheritance.cpp @@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include #include using namespace boost::hana; diff --git a/test/orderable/defaults.cpp b/test/orderable/defaults.cpp index a8f9c8790..1ac5d966f 100644 --- a/test/orderable/defaults.cpp +++ b/test/orderable/defaults.cpp @@ -6,7 +6,8 @@ Distributed under the Boost Software License, Version 1.0. #include -#include +#include +#include #include using namespace boost::hana; diff --git a/test/sandbox/function.cpp b/test/sandbox/function.cpp index c9e00b4cb..82de24809 100644 --- a/test/sandbox/function.cpp +++ b/test/sandbox/function.cpp @@ -5,7 +5,7 @@ Distributed under the Boost Software License, Version 1.0. */ #include -#include +#include // for operators::enable #include #include #include diff --git a/test/sandbox/logical.cpp b/test/sandbox/logical.cpp index 4bf7b4308..b399e1acd 100644 --- a/test/sandbox/logical.cpp +++ b/test/sandbox/logical.cpp @@ -5,7 +5,8 @@ Distributed under the Boost Software License, Version 1.0. */ #include -#include +#include +#include #include #include #include diff --git a/test/sandbox/matrix.cpp b/test/sandbox/matrix.cpp index 310a0a67c..8153369c4 100644 --- a/test/sandbox/matrix.cpp +++ b/test/sandbox/matrix.cpp @@ -5,7 +5,7 @@ Distributed under the Boost Software License, Version 1.0. */ #include -#include +#include // for operators::enable #include #include #include diff --git a/test/sandbox/strong_datatypes.cpp b/test/sandbox/strong_datatypes.cpp index f7b007fb3..920a85230 100644 --- a/test/sandbox/strong_datatypes.cpp +++ b/test/sandbox/strong_datatypes.cpp @@ -4,7 +4,7 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#include +#include #include #include namespace hana = boost::hana;