Commit Graph

991 Commits

Author SHA1 Message Date
Louis Dionne
fe774e1d6e Add basic support for Boost.Build 2015-10-19 09:53:20 -04:00
Louis Dionne
8a643a9c14 [optional] Make the interface closer to that of std::optional
Also remove `only_when`, which is frankly not very useful.
2015-10-12 11:29:37 -04:00
Louis Dionne
6ce5826b75 [Struct] Return a reference from at_key
Partially addresses #90
2015-10-12 10:45:49 -04:00
Louis Dionne
e0bcb8f6e1 [Tests] Modularize unit tests for Constant and integral_constant 2015-10-11 13:54:38 -04:00
Louis Dionne
35da925d19 [IntegralDomain] Rename to EuclideanRing
Note that no `norm` function is added for now, since the `norm` is not
tied to the specific Euclidean ring as explained in [1]. However, it
might be useful to enforce an arbitrary choice to be made for each
Euclidean ring. This could perhaps be added in the future.

Fixes #28

[1]: https://en.wikipedia.org/wiki/Euclidean_domain#Definition
2015-10-08 14:42:22 -04:00
Louis Dionne
d6acfe4164 Add detail::decay, a faster equivalent to std::decay 2015-09-30 15:40:41 -04:00
Louis Dionne
55d2845f99 Fix the build on Clang 3.8
- Properly fetch libc++ trunk on Travis
- Remove unused variable warnings
2015-09-28 15:57:24 -04:00
Louis Dionne
42934900b8 [Struct] Add the BOOST_HANA_ADAPT_ADT macro
Also
- Reorganize adaptation macro unit tests
- Add BOOST_HANA_PP_DROP_FRONT and BOOST_HANA_PP_FRONT macros
2015-09-22 13:37:49 -07:00
Louis Dionne
df7bdf5c69 [functional/apply] Behave like C++17's std::invoke 2015-09-22 10:40:23 -07:00
Louis Dionne
989d5f3f0a [map] Return a reference from at_key
Addresses this StackOverflow question: http://stackoverflow.com/q/32702383/627587
And also partially addresses #90.
2015-09-22 10:40:23 -07:00
Louis Dionne
403afe2dc9 [folds] Fix bugs in folds when taking state by reference
Partially addresses this SO question: http://stackoverflow.com/q/32702383/627587
2015-09-22 10:40:23 -07:00
Louis Dionne
5dd8a4c645 [Struct] Improve documentation about alternate interface for accessors
Addresses http://stackoverflow.com/q/32678647/627587
2015-09-21 23:54:22 -07:00
Louis Dionne
cf063a4fe3 Return hana::integral_constants from type_traits adapters
Also, remove the ext/std/{type_traits,utility} headers in favour of the
<boost/hana/traits.hpp> header.
2015-09-21 07:45:04 -07:00
Louis Dionne
800ec837c9 [type] Use qualified names in the unit tests 2015-09-21 06:43:14 -07:00
Louis Dionne
c9784816f4 Move /test/sandbox to /experimental
Closes #169
2015-09-16 12:48:09 -04:00
Louis Dionne
f57e125c71 [tuple] Add a unit test for trapping constructors 2015-09-15 18:39:20 -04:00
Louis Dionne
41c64b39a9 [IntegralDomain] Rename quot/rem to div/mod
Fixes #180
2015-09-14 14:18:29 -04:00
Louis Dionne
3fdfc475a1 [detail] Remove now unused generate_integer_sequence 2015-09-13 10:52:08 -04:00
Louis Dionne
1d7b720c95 [Enumerable] Remove that concept entirely.
Enumerable was not being used inside the library, and its usefulness
was questionable due to the lack of upper/lower bounds.

Closes #23
2015-09-12 17:59:58 -04:00
Louis Dionne
272e583ce5 [tuple] Optimize find_if and do minor refactoring 2015-09-12 15:07:52 -04:00
Louis Dionne
8e80aff466 [detail] Remove now obsolete variadic::for_each 2015-09-09 19:58:40 -04:00
Louis Dionne
eeb856a243 [detail/operators] Move the hana::operators to detail
Makes it clear that this is an implementation detail only. Also, slightly
improve the documentation of operators::adl.

Fixes #178
2015-09-09 18:32:32 -04:00
Louis Dionne
c32ec8c3d0 Reformulate many algorithms in terms of IntegralConstants instead of Constants 2015-09-09 15:55:18 -04:00
Louis Dionne
136ba9be56 [IntegralConstant] Add the repeat algorithm
Fixes #100
2015-09-09 15:37:31 -04:00
Louis Dionne
8b1b9ce0e6 Add the IntegralConstant concept
Also, make existing Constants models of IntegralConstant. This fixes #132
by making the definition of a model of Constant reasonably easy for
IntegralConstants.
2015-09-09 15:36:53 -04:00
Louis Dionne
a7f25d124e [slice] Accept an arbitrary Foldable of indices, and remove subsequence
Fixes #84
2015-09-08 17:29:54 -04:00
Louis Dionne
be5a787741 [CMake][Travis] Add support for building without exceptions
Also, swap the project() and the cmake_minimum_required() commands
in the top-level CMake file, as this silences a warning when building
on Cygwin. See #168.
2015-09-07 23:19:31 -04:00
Louis Dionne
f4c120441c [Sandbox] Clean up and remove obsolete files
- Promote the `Tree` experiment to an example
- Remove sandbox/string.cpp; which is nothing but string_view
- Refactor the Function example so it does not use exceptions
- Remove llist.cpp, which is a mostly uninteresting experiment
- Remove sandbox/array.cpp, which is essentially sprout::array
  (see https://github.com/bolero-MURAKAMI/Sprout)

The hidden goal of this commit is also to setup the place for building
without exceptions, by removing or modifying the tests that required
them.
2015-09-07 23:19:31 -04:00
Louis Dionne
423bc7220a [MonadPlus] Rename repeat to replicate 2015-09-07 22:43:35 -04:00
Louis Dionne
35c8d59074 Remove detail::closure, now replaced by basic_tuple 2015-09-07 16:32:14 -04:00
Louis Dionne
37dc041af5 [Functional][lazy] Use basic_tuple instead of closure<>
Also, modularize and refactor some unit tests for Functional utilities.
2015-09-07 16:31:23 -04:00
Louis Dionne
ef3d46e8aa [hana::pair] Document the constructors and add unit tests 2015-09-07 14:28:35 -04:00
Louis Dionne
65b91ece69 [integral_constant] Inherit from std::integral_constant
Fixes #92
2015-09-06 12:43:47 -04:00
Louis Dionne
cf56c3ab83 [Doc] Document new-style concepts and remove core/models.hpp 2015-09-05 19:27:38 -04:00
Louis Dionne
fd5e3ca715 [Concepts] Define concepts as template structs instead of using models<>
The `models<>` machinery added unnecessary complexity for little benefit.
Also, this makes Hana's concepts syntactically closer to concepts lite,
which should contribute to making them easier to grasp at first sight.
2015-09-05 19:25:01 -04:00
Louis Dionne
b9d0f6d2d1 [integral_constant] Rename IntegralConstant to integral_constant_tag 2015-09-03 13:29:17 -04:00
Louis Dionne
673a84c787 [ext/] Rename tags to xxx_tag for external adapters 2015-09-03 13:29:17 -04:00
Louis Dionne
19a2d9a1d6 [type] Rename Type to type_tag 2015-09-02 22:32:52 -04:00
Louis Dionne
de79e56a5f [string] Rename String to string_tag 2015-09-02 21:59:05 -04:00
Louis Dionne
79db7e90df [range] Rename Range to range_tag 2015-09-02 21:59:05 -04:00
Louis Dionne
a58ad3bdbc [basic_tuple] Rename BasicTuple to basic_tuple_tag 2015-09-02 21:59:05 -04:00
Louis Dionne
5cec8b3e2e [tuple] Rename Tuple to tuple_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
cd133c3a24 [optional] Rename Optional to optional_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
3a50767bd4 [pair] Rename Pair to pair_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
b2adb373ee [set] Rename Set to set_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
9168cc4ce8 [map] Rename Map to map_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
2110ef724d [lazy] Rename Lazy to lazy_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
c52c6d88d4 [Doc] Adjust the documentation to use "tag" instead of "data type" when it makes sense 2015-09-02 21:59:03 -04:00
Louis Dionne
4e3d17bd3b [Core] Do not use a nested ::hana struct to hold the tag.
This was annoying because

(1) We couldn't use the name hana:: from within the struct
(2) It requires one more instantiation unless you use the
    `using hana = self` trick. But that trick makes something
    that should be trivial to do slightly harder, and that is stupid.
2015-09-02 21:59:03 -04:00
Louis Dionne
f3d9df96d0 [Core] Rename datatype<> to tag_of<>
Also, rename the nested hana::datatype alias to hana::tag.
2015-09-02 21:59:03 -04:00
Louis Dionne
28d85747a4 [std::tuple] Fix unit tests broken by 08f66d4
The unit tests were not being run, because they are disabled for
clang < 3.7.0 due to bugs in libc++
2015-09-02 21:47:28 -04:00
Louis Dionne
08f66d47c1 [IntegralConstant] Suffix variable templates with _c, and clean up type names
Along with PR #166, this closes #122 because names have now been
cleaned up and are now consistent basically everywhere.
2015-09-01 16:34:04 -04:00
Louis Dionne
0ccb92776c Fix -Wself-move warning turned into error 2015-08-31 22:28:01 -04:00
Louis Dionne
6f2def29c0 [Tuple] Refactor and bullet-proof the implementation
- Use basic_tuple instead of closure<> for the inner storage
- Make sure the assignment operators are constexpr
- Copy the unit tests from closure<> (closure will eventually be removed anyway)

Fixes #165
2015-08-31 18:24:40 -04:00
Louis Dionne
a65db394c3 [String] Add make_string, for consistency 2015-08-31 17:28:44 -04:00
Louis Dionne
d8b08aa43c [Doc] Promote Metafunction from data type to concept, and document as such 2015-08-31 12:59:22 -04:00
Louis Dionne
98e76512a1 [Doc] Document hana::lazy instead of hana::Lazy 2015-08-31 11:42:57 -04:00
Louis Dionne
c2ed70ddf9 [Doc] Document hana::type instead of hana::Type
Precisely,
1. Rename hana::_type to hana::basic_type, and document it
2. Rename hana::type<> to hana::type_c<>
3. Create and document the hana::type<> type
2015-08-30 17:08:06 -04:00
Louis Dionne
d0492da082 [Doc] Document hana::integral_constant instead of hana::IntegralConstant 2015-08-30 17:07:19 -04:00
Louis Dionne
ed2eca2ddb [Doc] Document hana::string instead of hana::String 2015-08-30 17:07:19 -04:00
Louis Dionne
e4c1b44f8e [Doc] Document hana::set instead of hana::Set 2015-08-30 17:07:18 -04:00
Louis Dionne
6d80a308da [Doc] Document hana::tuple instead of hana::Tuple
Also, document the member functions of `hana::tuple` and add an example.

Fixes #163
2015-08-30 17:07:18 -04:00
Louis Dionne
c3046d0faf [Sandbox] Experiment with tuples holding references 2015-08-29 12:27:45 -04:00
Louis Dionne
980e97a3ef [Detail] Move stuff out of the constexpr/ subdirectory and namespace 2015-08-28 11:32:09 -04:00
Louis Dionne
af01c3a0d4 [Tests] Use hana:: qualified names 2015-08-28 11:32:09 -04:00
Louis Dionne
5b530824fe [GCC] Workaround bugs and warnings
- Fix ambiguous overload of `concat` for Optionals
- Fix compilation error in std::vector unit test
- Fix false positives related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66543
- Fix compilation error caused by variable template initialized by a lambda
2015-08-28 10:21:04 -04:00
Louis Dionne
8482d25b2e [Sandbox] Use is_a instead of hand-rolled predicate 2015-08-28 10:17:52 -04:00
Louis Dionne
307f0d8c50 Add the lexicographical_compare algorithm 2015-08-26 13:40:11 -04:00
Louis Dionne
9fb555fc4a [zip_shortest_with] Use a constexpr min_element instead of minimum(tuple(...)) 2015-08-26 11:27:28 -04:00
Louis Dionne
f373b421f9 [Headers] Minimize the #includes in headers
- Allow specializing models_impl with a forward declaration only
- Modularize remaining concept headers
- Include <boost/hana.hpp> in unit tests to ease the transition
- Add the core/dispatch.hpp header to reduce the number of boilerplate includes
2015-08-26 11:27:28 -04:00
Louis Dionne
92edd1c98f [Orderable] Remove Orderable::equal_impl 2015-08-24 21:35:34 -04:00
Louis Dionne
40a687bbcc [Monad] Remove Monad::ap_impl
We still document the implementation of `ap` for Monads, but we do not
provide it.
2015-08-24 21:35:34 -04:00
Louis Dionne
13d1247acf [Iterable] Automatically provide the model of Searchable for infinite Iterables 2015-08-24 18:51:31 -04:00
Louis Dionne
529f1cd459 [Either] Remove entirely
I had been unsatisfied with Either for a while now, thinking it might
be useless. I am now convinced that it is useless, and I hence remove
it from the library altogether.
2015-08-24 13:21:25 -04:00
Louis Dionne
e2c4c1f36e [Sequence] Add the remove_range algorithm
Closes #52
2015-08-23 13:49:16 -04:00
Louis Dionne
e42ce66d26 [Set,Map] Optimize several methods
Fixes #63
2015-08-23 12:00:59 -04:00
Louis Dionne
96f90f6956 [Set] Refactor the unit test of equal 2015-08-23 09:26:45 -04:00
Louis Dionne
12c4deeece [Set] Add missing set theoretic operations
Closes #119
2015-08-23 08:36:21 -04:00
Louis Dionne
89c61aec67 Use ::value instead of {}() everywhere 2015-08-23 07:52:14 -04:00
Louis Dionne
08b3db1708 [Examples] Modularize and use qualified names
This patch modularizes the examples, makes them self-contained and
also uses qualified hana:: names.

Fixes #139
Fixes #126
2015-08-15 17:50:40 +02:00
Louis Dionne
e5e1f761f9 [Searchable] Add the is_disjoint algorithm
Partially addresses #119
2015-08-12 22:00:32 +02:00
Louis Dionne
fd63f651d0 Add basic_tuple, a minimal version of the tuple 2015-08-08 13:16:02 +02:00
Louis Dionne
6b94de8ed3 [Either] Remove leading underscores forgotten in a5e5ee9 2015-08-08 11:37:59 +02:00
Louis Dionne
a5e5ee90bd Remove most leading underscores from names in the hana:: namespace
Fixes #130
2015-08-08 11:24:17 +02:00
Louis Dionne
aea2196cf7 [iterate] Workaround hitting recursive instantiation limit with libstdc++ 2015-07-26 17:25:54 +02:00
Louis Dionne
0893ae57f7 [Fusion adapters] Don't test the full laws, only the implemented methods
The Fusion adapters have been giving me trouble for a long time now.
The problem is that Hana's unit tests are more thorough than Fusion's,
and hence we keep uncovering Fusion bugs through Hana's unit tests.
This keeps on breaking the build and makes me lose valuable time trying
to workaround these bugs until they are fixed in Fusion's master branch.

Therefore, only the methods that are implemented by Fusion adapters are
tested to make sure they work as expected, but the other algorithms that
are derived from them are not tested on Fusion adapters.
2015-07-26 12:42:20 +02:00
Louis Dionne
9d74084996 Remove take_until and some xxx_exactly variants
Of the xxx_exactly variants, only drop_front_exactly is kept for now,
because it actually allows an optimization. The other ones did not
really provide a compile-time improvement, so they are removed.
2015-07-26 12:42:20 +02:00
Louis Dionne
8a0ddb0fa7 [Closure] Reimplement the closure to be almost standards-conforming
Also, use that closure to implement basically all containers.
The new closure compresses empty types.

Fixes #123
Fixes #93
Fixes #89
2015-07-26 12:42:20 +02:00
Louis Dionne
8145d66422 [Iterable] Require length to implement unpack 2015-07-25 16:20:48 +02:00
Louis Dionne
bf232cb5a7 [Tuple] Make the definition as minimal as possible 2015-07-25 16:20:48 +02:00
Louis Dionne
6f73c881b3 [ext::boost::Tuple] Workaround non-variadic implementation of boost::tuple
Yeah, this is a cheap workaround, but I'm not going to lose any time
with this old cruft. Sorry.
2015-07-25 16:20:48 +02:00
Louis Dionne
a42544da1e [Sequence] Enforce the finiteness of Sequences and reword the laws
Also, optimize `equal` for sequences.

Fixes #39
2015-07-25 16:20:48 +02:00
Louis Dionne
cecaf823f6 [Iterable] Replace front by at in the MCD to allow more efficient algorithm implementations
Related to #158
2015-07-25 16:20:48 +02:00
Louis Dionne
3e50562a48 [Iterable] Optimize drop_{while,front} for finite Iterables 2015-07-25 16:20:47 +02:00
Louis Dionne
d3b7cb2c85 Modularize the headers
This (large) commit introduces the following changes:
- Each algorithm lives in its own header
- The concepts are defined in the concept/ subdirectory. They define the
  `models` metafunction, some explicit default implementations (like
  Applicative::transform_impl), and they include all the algorithms
  related to that concept.
- Removed the `until` method from Logical
- Removed the `drop_until` method from Iterable
- [minor] Added the detail::nested_to utility

Closes #160
2015-07-25 16:20:47 +02:00
Louis Dionne
dcfdb09ff9 [Struct] BOOST_HANA_ADAPT_STRUCT does not require the types of the members
Fixes #152
2015-06-28 21:01:09 +02:00
Louis Dionne
c6045da6ee [Sequence] Use underscores instead of dots to name zip variants
Also, remove unzip since it is easily implemented with unpack and zip.

Addresses #114
2015-06-28 11:43:29 +02:00
Louis Dionne
09955bf1b7 Use drop_front/drop_back front/back instead of asymmetrical names
- Replace init by drop_back and drop_back_exactly
- Rename head to front
- Rename last to back, and also rewrite the default implementation
  in terms of at instead of using (inefficient) recursion.
- Rename drop[_exactly] to drop_front[_exactly]
- Remove drop_c

Note that tail is kept for the moment because it is part of Iterable's
MCD. Removing tail will be the subject of a different issue.

Fixes #66
2015-06-28 10:44:28 +02:00
Louis Dionne
1e89c69049 [CMake] Remove LIBCXX_ROOT cruft and properly explain the situation in the README
Also:
- Remove the boost_hana_add_executable function, which is now useless
- Properly set the LD_LIBRARY_PATH to link against a custom libc++
- Adjust the Travis build

Fixes #135
2015-06-24 20:07:13 -04:00
Louis Dionne
c585bdc789 [Sequence] Rename unfold<S>.{left,right} to unfold_{left,right}<S>
Partially addresses #114
2015-06-22 18:41:07 -04:00
Louis Dionne
7ad0acf8eb [Optional] Make the constructor explicit
This is a workaround to fix #149, but a proper fix will actually require
a new closure implementation.

Fixes #149.
2015-06-21 18:03:20 -04:00
Louis Dionne
1b45d87a42 [Iterable] Rename drop.at_most to drop and drop.exactly to drop_exactly
Partially addresses #114
2015-06-21 12:08:23 -04:00
Louis Dionne
46207eed20 [Sequence] Rename take.at_most to take, and take.exactly to take_exactly
Partially addresses #114
2015-06-21 11:50:02 -04:00
Louis Dionne
4bef99d3d0 [Core] Completely remove operators from the core
Properly providing operators for users was too complicated, and it is
judged as being out of Hana's scope.

Instead, operators are now provided by helper classes in the detail::
namespace. Now, we can be as dirty as we want, since it is not part of
the interface anymore.

Fixes #138
Closes #30
2015-06-20 17:56:40 -04:00
Louis Dionne
18d39cd410 [Sequence] Rename scan.{left,right} to scan_{left,right}.
Partially addresses #114
2015-06-16 13:00:15 -04:00
Louis Dionne
7150695767 [Foldable] Use underscore syntax for monadic folds
Also,
- Fix broken reference to fold_right/fold_left in the cheatsheet

Partially addresses #114
2015-06-14 16:56:24 -04:00
Louis Dionne
2f4bd71686 [Tests] Group the unit tests for Foldable and Sequence mcds 2015-06-14 12:51:37 -04:00
Louis Dionne
724b2b36f1 [Iterable] Provide only Iterable::fold_right_impl
- This fixes a bug where we used `init` in Iterable::fold_right_impl
- Also fixes the Foldable's default implementation of fold_right without a state
2015-06-14 12:41:24 -04:00
Louis Dionne
3a13f0a8f7 [Struct] Make the accessors created by struct macros constexpr
Also,
- Add missing includes to the struct_macros.hpp header
- Make sure we avoid issue #113

Fixes #112
Fixes #113
2015-06-14 12:13:21 -04:00
Louis Dionne
55c095ebbb [Foldable] Remove fold_right from the MCD
Also,
- Document the fact that the default `unpack` is inefficient
- Give a single implementation of `length` in terms of `unpack`
- Doxygen: product = see documentation

Fixes #108
2015-06-14 10:59:07 -04:00
Louis Dionne
b5a9a2e2c9 [Foldable] Rename fold.{left,right} to fold_{left,right}
Fixes #106
2015-06-14 10:07:04 -04:00
Louis Dionne
d99899cb02 [IntegralConstant] Guarantee the order of execution for .times.with_index 2015-06-12 17:30:37 -04:00
Louis Dionne
d04b175eb3 [Map] Fix test broken by 71ca00dcf7 2015-06-12 16:40:26 -04:00
Louis Dionne
36575dbb89 Fix a bug when checking models<> for concepts with binary methods
Also, check the models<> metafunction properly in the laws.

Fixes #91
2015-06-12 15:23:07 -04:00
Louis Dionne
71ca00dcf7 [Map,Set] Make sure make<..> is passed compile-time Comparable keys 2015-06-12 15:23:07 -04:00
Louis Dionne
1022f74fa7 Remove our partial <type_traits> reimplementation
There was a legitimate reason to have this duplication when the library
was much smaller. However, hovering at about 30 kLOCs, the library is
definitely not small enough anymore to mandate reimplementing our own
<type_traits>. Also, most user code will probably include <type_traits>
anyway, so using <type_traits> will not increase the overall compilation
time in actual code bases.

Finally, this gives us much more flexibility, like the ability to
inherit our IntegralConstant from std::integral_constant, and then
return that from the traits:: metafunctions, so that operators can
be used with them.
2015-06-12 12:49:22 -04:00
Louis Dionne
35cdf3b83a [Struct] Implement macros using ERB templates instead of Boost.Preprocessor
This is done because the resulting macros are much more straightforward
to debug when a user makes a mistake. Also, it avoids pulling yet another
dependency.

Also added some general purpose macros in detail/preprocessor.hpp.
2015-06-10 15:50:35 -04:00
Louis Dionne
9928dea216 [Traversable] Remove that concept entirely
That concept was added more for completeness than for actual usefulness,
since I have not used it a single time since its creation. Given the
complexity of the library, I think it is better to remove it and shrink
the library to a more useful core than giving too many features that
contribute to bloat.

Also, the laws were difficult to check and it hence Traversable models
were not very well tested anyway.

I can always roll this back if someone shows me how Traversable is
actually useful for metaprogramming.
2015-06-10 10:07:55 -04:00
Louis Dionne
951bc46cd2 [Range] Optimize Range operations by requiring the Range to hold IntegralConstants 2015-06-08 21:03:12 -04:00
Louis Dionne
7a4919e69d [MonadPlus] Swap the arguments of prepend and prefix 2015-06-08 18:13:04 -04:00
Louis Dionne
09b8e38113 [Sequence] Add insert and insert_range functions
Partially addresses #52
2015-06-08 17:04:52 -04:00
Louis Dionne
9c2d3b396a Rename Maybe to Optional 2015-06-08 14:49:26 -04:00
Louis Dionne
ff90ce4e72 [Maybe] Add make<Maybe> and make_maybe for consistency 2015-06-07 17:43:51 -04:00
Louis Dionne
7b1de7fe43 [Travis] Speed up the travis build
- Make sure the check.benchmarks are serialized
- Run Doxygen with Clang 3.6 instead of Clang trunk
- Download prebuilt Doxygen instead of building from source
- Run unit tests on two cores
2015-06-05 19:38:27 -04:00
Louis Dionne
90437a8a6d [Range] Merge the unit tests into a single file with parts 2015-06-04 23:14:21 -04:00
Louis Dionne
07f15e171f Normalize the parameter order of take, suffix, remove_at, cycle and repeat
Closes #83
2015-06-04 22:29:13 -04:00
Louis Dionne
077dc7b6c9 [Iterable] Normalize parameter order for at and drop
Partially addresses #83
2015-06-04 21:13:51 -04:00
Louis Dionne
555f252451 [Iterable] Rewrite any_of so it works with infinite iterables
Fixes #31
2015-06-03 14:41:42 -04:00
Louis Dionne
c832df8b1e [Sequence] Add the unique{.by} algorithm
Partially addresses #52
2015-06-03 14:06:56 -04:00
Louis Dionne
0ff9572382 Create the detail::by helper to provide a .by static member.
Also improve the documentation of the algorithms with a .by version.
2015-06-03 12:17:29 -04:00
Louis Dionne
4ce522ec20 [Set, Map] Add the erase_key function
Partially addresses #52
2015-06-03 10:11:13 -04:00
Louis Dionne
a32de51bfa [String] Add an optional _s user-defined literal to create Strings
Fixes #79
2015-06-02 14:45:38 -04:00
Louis Dionne
535bc937b6 [Type] Do not treat Types and values differently in is_valid
Fixes #58
2015-06-01 18:06:38 -04:00
Louis Dionne
647e695951 [CMake] Add the check target and fix minor annoyances 2015-05-30 12:23:01 -04:00
Louis Dionne
a5245c0a72 [Core] Fix weird compilation error with is_an on Clang 3.5 2015-05-26 15:12:44 -04:00
Louis Dionne
6159007c15 [IntegralConstant] Write proper unit tests for .times and .times.with_index 2015-05-26 11:20:03 -04:00
Louis Dionne
f81f732390 Convert some RUNTIME_ASSERTs into RUNTIME_CHECKs 2015-05-26 10:52:38 -04:00
Louis Dionne
6ee5137604 [GCC] Workaround GCC ICEs and bugs 2015-05-24 21:00:27 -04:00
Louis Dionne
dc909f8900 [GCC] Remove unused parameter warnings and disambiguate use of size_t 2015-05-24 21:00:26 -04:00
Louis Dionne
aa2edb08ce [CMake] Reduce the number of targets and modularize the code 2015-05-22 16:23:54 -04:00
Louis Dionne
2b0846a79a Fix ODR violations caused by multiple definitions in header
This commit fixes issue #75, but it does not fix the related issue #76.
It only makes sure that function objects are not defined multiple times,
but does not ensure the uniqueness of the addresses of the function
objects, which is much harder to get right.

Fixes #75
2015-05-21 16:38:00 -04:00
Louis Dionne
8f117eaba8 [Tuple] Fix bug in flatten with GCC and remove unused variable warnings 2015-05-20 16:56:48 -04:00
Louis Dionne
0660af6a8f [GCC] Initial port to GCC
- Fix ambiguous specialization in core/datatype
- [Config] Turn #errors into #warnings
- Qualify recursive calls to `apply` to make sure the right function is selected
- Remove usages of when_valid to workaround ambiguous specializations
- Use multiline comments to remove some GCC warnings with LaTeX's double backslash
- Specialize operators::of in the boost::hana::operators namespace
- Manually perform more conversions in constexpr-context
- Workaround the lack of support for constexpr-but-non-const member functions
- Disambiguate unqualified uses of size_t with hana::size_t and ::size_t
2015-05-20 16:56:34 -04:00
Louis Dionne
e1ed31f3aa [Constant] Test the equivalence between value_of and value 2015-05-20 16:46:58 -04:00
Louis Dionne
6e9a7a28c9 [Ext] Disable failing Fusion tests because of Fusion bugs 2015-05-20 13:33:42 -04:00
Louis Dionne
5019db00c4 [Detail] Make sure variadic::for_each is constexpr 2015-05-19 11:56:19 -04:00
Louis Dionne
90ddffe54d [Sequence] Add the cartesian_product method
Also, replace the old tuple_cartesian_product by a newer, slightly
more efficient but much simpler version.
2015-05-19 11:55:50 -04:00
Louis Dionne
daea3549d5 [Struct] Add the keys method to Structs 2015-05-14 16:42:56 -06:00
Louis Dionne
fc18a6cc21 [ext/fusion] Increase MAX_VECTOR_SIZE to fix failing tests 2015-05-06 18:59:05 -04:00
Louis Dionne
2e483fb9fc [Tests] Fix bug in the sequence law checking
When BOOST_HANA_TEST_SEQUENCE_PART was defined, only the first section
of the tests would be run because we used #elif. Dumb me.
2015-05-06 15:47:36 -04:00
Louis Dionne
5181793455 [Tuple] More efficient implementation of filter, still not incredible
Also add benchmarks for filter
2015-05-05 14:05:55 -04:00
Louis Dionne
8446de09a0 [Sequence] Use pointers to avoid extra copies in partition 2015-05-04 14:01:45 -04:00
Louis Dionne
ad69eab92d [Sandbox] Rename subset to is_subset in SearchableSet (broken by 6ca6501) 2015-05-04 14:01:45 -04:00
Louis Dionne
3e0838b1e2 [Functional] Move reverse_partial from detail to functional 2015-05-04 14:01:45 -04:00
Louis Dionne
6ca6501278 [Searchable] Refactor the interface
- Rename elem to contains
- Rename subset to is_subset, and make is_subset applicable in infix notation
- Add the at_key method
- operator[] is now bound to at_key instead of find
2015-05-04 12:33:51 -04:00
Louis Dionne
a9cf8bf9e7 [CMake] Exclude ext/boost/fusion/detail from the automatic header tests 2015-05-03 13:34:51 -04:00
Louis Dionne
334cbeb188 [Tuple] Allow brace-initializing tuple members
Fixes #57
2015-05-03 13:34:51 -04:00
Louis Dionne
dc56f6cebc [String] Add conversion to char const* and minor refactoring
Also
- remove useless value_type alias in String since it's not a Constant
- document why the interface is so minimal
2015-05-02 15:24:25 -04:00
Louis Dionne
65834220b7 [Type] Fix bug in the implementation of is_valid with nullary functions 2015-05-02 13:36:24 -04:00
Louis Dionne
b2145a2640 [IntegralConstant] Fix a bug with the .times function
Passing a normal function to .times would fail
2015-05-01 19:41:22 -04:00
Louis Dionne
3568186dac [Type] Add the is_valid utility.
Also refactor the overview in the README.
2015-05-01 15:54:22 -04:00
Louis Dionne
e6d0fa9487 [CMake] Use Find modules to find optional external libraries 2015-04-28 10:46:44 -04:00
Louis Dionne
9a412f9c39 [MPL] Add a conversion from Foldables to MPL vectors
Also, properly split the unit tests for mpl::vector
2015-04-26 14:20:15 -04:00
Louis Dionne
b452dc4de3 Remove most usages of detail::std::forward 2015-04-26 09:22:04 -04:00
Louis Dionne
69c02987ef [Tests] Automatically discover test subparts 2015-04-25 23:32:39 -04:00
Louis Dionne
ef7dcf6800 [Tuple] Fix bug in the new optimized find_if 2015-04-25 17:57:09 -04:00
Louis Dionne
1ee3b93a08 [Tuple] Implement a more efficient drop_while and find_if 2015-04-25 16:31:50 -04:00
Louis Dionne
589425a6dd [Core] Make has_operator an IntegralConstant
Fixes #51
2015-04-22 07:35:11 -04:00
Louis Dionne
8e427f2c83 [Searchable] Provide an operator[] equivalent to find 2015-04-21 21:56:47 -04:00
Louis Dionne
a3ce836049 [Searchable] Document structure-preserving functions and allow cross-type dispatching in subset 2015-04-21 20:23:24 -04:00
Louis Dionne
f87919b94b [Record] Rename to Struct and refactor
- Define the notion of move-independence, thus relaxing the requirements on accessors.
- Rename `members` to `accessors` and use `members` to get the members only
- Document the different ways of providing a model
- Make the model of Foldable more consistent

Fixes #53
2015-04-21 16:32:33 -04:00
Louis Dionne
fb518d859a [Monad] Renaming and refactoring.
- Rename bind to chain
- Rename mcompose to monadic_compose
- Rewrite a large part of the documentation
- Document the limit on the arity of functions used with monadic_compose

Fixes 48
Fixes 9
2015-04-19 13:13:23 -04:00
Louis Dionne
ac2f5222cd [Travis] Run the unit tests under valgrind 2015-04-18 22:36:40 -04:00
lolisa
21952b9f54 comment out unused variable.
[ldionne: rebase and remove the -Wno-unused-parameter flag from CMake]

Closes #43
2015-04-14 16:23:51 -04:00
Louis Dionne
0612624939 [Detail] Add basic unit tests for the constexpr algorithms. 2015-04-14 13:32:45 -04:00
Louis Dionne
686656a3f2 [Iterable] Add the drop.at_most and drop.exactly variants to drop 2015-04-12 11:29:02 -04:00
Louis Dionne
1171b83fe3 [Sequence] Add the subsequence method
Fixes #37
2015-04-12 10:47:12 -04:00
Louis Dionne
93343e8317 [Tests] Send objects containing Logicals only to the Searchable tests 2015-04-11 13:45:55 -04:00
Louis Dionne
6abd0f9d8e [Set] Improve the documentation and fix inconsistency in the behavior of to<Set> 2015-04-11 12:49:45 -04:00
Louis Dionne
daaba5dfd8 [Map] Provide model of Foldable, improve docs and add insert method.
Fixes #41
2015-04-11 12:09:01 -04:00
Louis Dionne
8bd84a5d4b [Metafunction] Generalize trait to arbitrary Metafunctions and improve docs 2015-04-11 09:29:06 -04:00
Louis Dionne
08e55a7bb6 Rework the relations between Foldable, Iterable and Searchable. 2015-04-10 17:46:14 -04:00
Louis Dionne
c434f134ba [Applicative] Implement automatic law checking 2015-04-10 13:17:51 -04:00
Louis Dionne
b21fdc32de [Detail] Remove obsolete detail::wrap utility 2015-04-10 09:38:32 -04:00
Louis Dionne
a12315c1a6 [Detail] Add constexpr algorithms and use them in the implementation 2015-04-10 08:33:18 -04:00
Louis Dionne
17169d99d3 [Constant] Document conversions, embeddings and related material. Fix TODOS 2015-04-09 11:18:03 -04:00
Louis Dionne
fa2cdeef24 [Test] Remove outdated TODO items 2015-04-08 13:17:59 -04:00
Louis Dionne
22b82faacc [Detail] Optimize the left and right variadic folds 2015-04-08 11:20:00 -04:00
Louis Dionne
80e0adf4e8 [Core] Move wrong to the detail namespace 2015-04-07 19:37:28 -04:00
Louis Dionne
5c1a752a9f [Pair] Remove the pair constructor in favor of make_pair 2015-04-07 19:26:59 -04:00
Louis Dionne
ef609d990c [Test] Add a unit test for while_ for CNumerics 2015-04-07 19:00:50 -04:00
Louis Dionne
fad34112bb [Test] Fix wrong argument order to TestMonadPlus in laws/templates/seq.hpp 2015-04-07 17:48:14 -04:00
Louis Dionne
8c8743fe5c [Test] Add a unit test for while_ 2015-04-07 17:47:33 -04:00
Louis Dionne
0246c59c6c [Sandbox] Remove the hana/sandbox folder and put everything in test/sandbox 2015-04-07 16:52:20 -04:00
Louis Dionne
40216cde23 [MonadPlus] Add the remove and remove_if functions to MonadPlus 2015-04-07 16:27:39 -04:00
Louis Dionne
0a46420c02 [Type] Major refactoring and improvements
- Make decltype_ the identity on Types
- Add the alignof_ function
- Allow sizeof_ to work with non-Types
- Remove the trait_ helper
- Allow Metafunctions to be called with non-Types
- Add make<Type>, which is equivalent to decltype_
2015-04-07 12:12:52 -04:00
Louis Dionne
3c2aa421b5 [Tuple] Provide efficient folds for tuple_t
Fixes #32
2015-04-06 14:28:09 -04:00
Louis Dionne
125fd45bfd [Functional] Add the overload_linearly utility 2015-04-06 14:11:42 -04:00
Louis Dionne
1d7f28f941 [CMake] Improve the build system
- Simplify the compiler flag logic
- Use WARNING instead of STATUS to report caveats
- Allow specifying a custom libc++ root directory
2015-04-02 00:50:58 -04:00
Louis Dionne
13392c7ed2 [Foldable] Use overloads for {maximum,minimum}_by 2015-04-01 19:28:42 -04:00
Louis Dionne
eb4f07a61c [Sequence] Use overloads for sort/sort_by and group/group_by 2015-04-01 19:28:42 -04:00
Louis Dionne
aaaab0e11d [Foldable] Allow specifying the Monoid/Ring for sum/product
Fixes #33
2015-04-01 16:19:37 -04:00
Louis Dionne
38e02e9f53 [Sequence] Rename scan{l,r,l1,r1} similarly to folds 2015-03-31 17:55:27 -04:00
Louis Dionne
0e1f5987b1 [Sequence] Fix stupid typo that broke compilation in the laws 2015-03-30 21:40:14 -04:00
Louis Dionne
a215f0a1b1 [Monad] Add tests for the bind method for Sequences 2015-03-30 18:30:59 -04:00
Louis Dionne
59d7e36726 [Sequence] Rename unfolds and flip their parameters 2015-03-30 18:17:42 -04:00
Louis Dionne
2c86ba2390 [Foldable] Rename the different fold variants
- Rename fold{l,r,l1,r1} to fold.{right,left} with overloads.
- Rename foldlM/foldrM to monadic_fold.{left,right}
- Add no-state variants of the monadic folds
- Improve the fold's documentation
- Deprecate the previous folds; they'll be removed soon

Fixes #18.
2015-03-30 17:29:37 -04:00
Louis Dionne
540f665e51 Use static_cast<T&&> instead of forward<T> to reduce compile-times
It might seem overkill to do this, but I measured:
static_cast:
    make compile.test.tuple  92.58s user 4.85s system 99% cpu 1:37.93 total
    make compile.test.tuple  91.89s user 4.78s system 99% cpu 1:37.07 total
    make compile.test.tuple  92.51s user 4.77s system 99% cpu 1:37.73 total
    make compile.test.tuple  95.91s user 5.16s system 99% cpu 1:41.60 total
    avg: 98.1125s

forward:
    make compile.test.tuple  108.16s user 5.50s system 99% cpu 1:54.36 total
    make compile.test.tuple  110.00s user 5.55s system 99% cpu 1:56.17 total
    make compile.test.tuple  108.41s user 5.47s system 99% cpu 1:54.46 total
    make compile.test.tuple  107.31s user 5.54s system 99% cpu 1:53.46 total
    avg: 113.985s

This shows an improvement of the average by 15.8725s, which
represents about 13.9%.
2015-03-29 11:14:24 -04:00
Louis Dionne
a98d32cae1 [Maybe] *just(x) is now equivalent to from_just 2015-03-29 10:39:04 -04:00
Louis Dionne
679677ab38 [minimal_record] Fix a double-move bug 2015-03-29 01:31:32 -04:00
Louis Dionne
7402a010ec [Tests] Track test::integer and use hana::capture instead of lambda capture to workaround Clang bug 2015-03-29 01:31:31 -04:00
Louis Dionne
637c5270ab [Functional] Add hana::capture 2015-03-28 22:22:13 -04:00
Louis Dionne
4390aa98df [Maybe] Fix bug in sfinae with non-pod arguments 2015-03-28 20:44:22 -04:00
Louis Dionne
ab1d294cec [Tests] Remove obsolete automatic tests in test/auto. 2015-03-26 02:08:44 -04:00
Louis Dionne
beb72c224f Remove some more usage of lambdas 2015-03-26 02:08:44 -04:00
Louis Dionne
f92be805d0 [fusion::vector] Split the tests for Sequence 2015-03-25 16:19:11 -04:00
Louis Dionne
2ecedc140c [Functional] Add the iterate combinator 2015-03-25 12:26:04 -04:00
Louis Dionne
8f999feae2 [CMake] Disable additional broken Fusion tests. 2015-03-25 11:02:22 -04:00
Louis Dionne
eb42d3c673 [CMake] Disable fusion::tuple test for Monad because of a Fusion bug 2015-03-24 17:01:39 -04:00
Louis Dionne
8238bc4c38 [Tests] Re-enable unbroken Fusion tests 2015-03-24 16:21:07 -04:00
Louis Dionne
dfa46fcd69 [Test] Properly split std::tuple's Sequence unit tests 2015-03-24 14:57:41 -04:00
Louis Dionne
224bc2cf9a [Tests] Split the unit tests for mpl::integral_c 2015-03-22 21:06:37 -04:00
Louis Dionne
afa9171eec [Foldable] Add fold and reverse_fold aliases 2015-03-22 17:18:26 -04:00
Louis Dionne
6ae5eb2b0f [Tests] Reimplement foreachN to avoid Clang ICEs 2015-03-22 15:54:07 -04:00
Louis Dionne
46b4def732 [Iterable] Rewrite any_of for Iterable to improve performance and work around Clang ICE
Partially addresses #24
2015-03-22 15:54:07 -04:00
Louis Dionne
2bd2b1239c Fix bugs with copy constructors in almost all the containers 2015-03-22 12:15:32 -04:00
Louis Dionne
5211da5a5d [Logical/Lazy] Tie eval_if and eval together, and update the docs
- Improve the documentation and tests of Lazy
- Add missing `operator!` to Logical's documentation
- In `eval_if`, evaluate branches with `eval` for more flexibility
- Use `lazy` instead of ugly workarounds in Sequence and Iterable
2015-03-22 10:58:21 -04:00
Louis Dionne
fbee0a6068 [test/set.cpp] Store permutations in hana::tuple instead of test::seq 2015-03-21 22:56:04 -04:00
Louis Dionne
483969e68c [Tests] Localize iteration whenever possible to reduce compile-times 2015-03-21 00:32:31 -04:00
Louis Dionne
17d07ccf4c [Travis] Restart jobs after OOMs 2015-03-21 00:32:09 -04:00
Louis Dionne
466bb3c1ad Add the Comonad concept and refactor Lazy 2015-03-20 11:55:32 -04:00
Louis Dionne
2d1edb14ff [CMake] Disable some failing Fusion unit tests 2015-03-20 00:44:23 -04:00
Louis Dionne
41914809a2 [Travis/Test] Clean up and modularization
- Properly setup build matrix
- Clean up .travis.yml
- Try building with Boost 1.57 and Boost 1.58
- Install dependencies to the deps/ subdirectory
- Reduce memory usage of test/type.cpp
- Re-enable some Fusion tests
2015-03-19 12:45:26 -04:00
Louis Dionne
52afb17a43 [Tests] Split unit tests in a much more clever way using CMake 2015-03-18 19:28:21 -04:00
Louis Dionne
a8586ec181 [Lazy] Fix move from destroyed object bug 2015-03-15 00:18:32 -04:00
Louis Dionne
5ab6925364 [Test] Fix some tests that fail on Travis and remove warnings 2015-03-15 00:18:31 -04:00
Louis Dionne
744ac273b4 [ext/std/vector] Monomorphic => can't be a Functor 2015-03-15 00:18:31 -04:00
Louis Dionne
1b8b5a5e2f [ext/std/array] Can't be made a Sequence because it's homogeneous 2015-03-15 00:18:31 -04:00
Louis Dionne
463040d318 [Searchable] Rename find to find_if and lookup to find 2015-03-15 00:18:31 -04:00
Louis Dionne
b69f29ac7a [Functor] Rename replace to replace_if, and add replace 2015-03-15 00:18:30 -04:00
Louis Dionne
bcf573ccc6 [Functor] Rename adjust to adjust_if and add adjust 2015-03-15 00:18:30 -04:00
Louis Dionne
cde54c9ec0 [Foldable] Rename count to count_if and add count 2015-03-15 00:18:30 -04:00
Louis Dionne
112e34e8a1 [Foldable] Add a size alias to length 2015-03-13 19:54:28 -04:00
Louis Dionne
7a309d08c6 [Type] Remove some places where we read from non-constexpr variables 2015-03-13 19:54:28 -04:00
Louis Dionne
356a1991b3 [Travis] Remove some MCD tests on Travis because we timeout/OOM 2015-03-13 12:16:34 -04:00
Louis Dionne
261ee2e729 Test comparing and ordering in the laws 2015-03-13 12:14:35 -04:00
Louis Dionne
af4ff59bfb [Core] Add is_a and make sure models<> returns an IntegralConstant 2015-03-13 12:14:32 -04:00
Louis Dionne
56484a3ac9 [CMake] Improve the build system and the targets
- Split targets to compile and run tests
- Add run.* targets to run each target
2015-03-12 14:44:14 -04:00
Louis Dionne
9cc9ca4b0e [Travis] Add support for Travis CI 2015-03-12 14:42:50 -04:00
Louis Dionne
4671796d28 [Pair] Add make_pair and improve tests 2015-03-12 11:52:51 -04:00