Commit Graph

991 Commits

Author SHA1 Message Date
Louis Dionne
a757f7fb7c [basic_tuple] Provide a model for Iterable and Sequence
Also remove the ad-hoc model of Comparable, which is now obsolete.
2016-02-29 10:23:41 -05:00
Louis Dionne
50a8bd3684 [tests] Add automatic unit tests for at 2016-02-29 09:08:05 -05:00
Louis Dionne
3475065f23 [tests] Add an automatic unit test for is_empty 2016-02-29 09:08:05 -05:00
Louis Dionne
df94a16210 [basic_tuple] Provide a model for Functor 2016-02-27 14:36:57 -05:00
Louis Dionne
3bea6c0ab0 [basic_tuple] Add a working copy constructor 2016-02-27 14:36:57 -05:00
Louis Dionne
a6438720c0 [tests] Add an automatic test for transform 2016-02-27 14:36:57 -05:00
Louis Dionne
3d00428646 [tests] Fix include paths when running tests with Boost.Build 2016-02-23 14:51:14 -05:00
Louis Dionne
6798df624e [tests] Reorganize the test/_support folder
- Rename test/_support to test/_include
- Move stuff from test/_include/test to test/_include/support
- Move stuff in test/_include/support into global namespace
2016-02-22 19:09:50 -05:00
Louis Dionne
897be1cdd9 [tests] Remove duplicate code by creating two reusable move-only types 2016-02-22 17:56:29 -05:00
Louis Dionne
b3ac1249b7 [set] Fix set tests failing due to non-Hashable keys 2016-02-21 15:16:55 -05:00
Louis Dionne
c30c0f3c8d [optional] Specify the template parameters of optional
Closes #254
2016-02-21 10:24:32 -05:00
Sergey Nizovtsev
5d07902329 Correctly forward std::extent value_type to hana::traits::extent
Fixes #252
2016-02-19 22:13:26 +03:00
Louis Dionne
eaa4cd7f8e [map] Reimplement hana::map using a hash table 2016-02-16 15:50:41 -05:00
Louis Dionne
3a2ad0b2b5 [Hashable] Improve documentation and tests 2016-02-16 15:24:23 -05:00
Jason Rice
da29858d1b [hash] type-level hash for associative containers
- Hashable concept
    - hash function
2016-02-16 15:24:23 -05:00
Louis Dionne
c0520b68b9 [test] Add unit test to check for Github issue #234
The commit that actually fixes this issue is 7f7c7a19, which adds an
embedding from `char` to any integral type with the proper signedness.

Closes #234
2016-02-15 14:54:00 -05:00
Louis Dionne
e5e9c44825 [types] Add a fast contains function based on detail::any_of 2016-02-15 10:14:03 -05:00
Louis Dionne
ce03e0cc75 [detail] Add a fast any_of metafunction using SFINAE 2016-02-15 10:14:03 -05:00
Louis Dionne
357aeea527 [experimental] Add types<>, a Sequence specialized for holding types 2016-02-15 10:14:03 -05:00
Louis Dionne
b1696fe0cc [Metafunction] Do not automatically call decltype_ on metafunction arguments 2016-02-15 10:07:08 -05:00
Louis Dionne
6e257fa7e1 [flatten] Extract the computation into unpack_flatten 2016-02-12 15:16:49 -05:00
Louis Dionne
7f7c7a19a9 [core] Add embedding from char to any integral type with proper signedness 2016-02-11 11:28:10 -05:00
Louis Dionne
31aa2e6f60 [core] Use signed keyword on signed integer types to define embeddings 2016-02-11 11:18:11 -05:00
Louis Dionne
30be9a677a [core] Mark conversion from 'char' to 'short' as embedding 2016-02-11 10:42:35 -05:00
Louis Dionne
15b5e32c7d [tests] Modularize the unit tests for std::pair, std::tuple and std::ratio 2016-02-05 18:19:24 -05:00
Louis Dionne
75f6be09ce Return references from at, at_key & friends
Resolves #90
2016-02-05 18:19:23 -05:00
Louis Dionne
c6ca6497c4 [test] Rename test.tuple.get.* to test.tuple.at.* 2016-02-05 18:19:23 -05:00
Louis Dionne
23c3edc93b [NFC] Un-Doxygenize comments in non-header files 2016-02-04 11:07:41 -05:00
Louis Dionne
12939a0d70 [build] Satisfy the Boost library requirements for testing 2016-02-01 11:37:12 -05:00
Louis Dionne
f0ea20f7e8 [map] Add a default constructor
Closes #197
2016-01-31 14:51:48 -05:00
Louis Dionne
fdc6335c2e [integer_sequence] Add unit tests and benchmarks for find_if
Initially, this commit was supposed to provide a slightly
optimized version of `find_if` for `integer_sequence`.
Unfortunately, benchmarking did not show any significant
difference, and so the current implementation will be kept.

Benchmark data is here: http://pastebin.com/t3M8YwzD
2016-01-29 13:04:33 -05:00
Louis Dionne
3d92428052 [tests] Split unit tests for integer_sequence 2016-01-29 12:46:29 -05:00
Louis Dionne
b952e0dfee [tests] Rename test/bugs directory to test/issues 2016-01-26 13:21:56 -05:00
Louis Dionne
aae8559d8a [test] Add unit tests for is_embedded 2016-01-25 23:20:07 -05:00
Louis Dionne
f7a2ac5f45 [examples] Use to_tuple instead of to<tuple_tag> 2016-01-18 17:31:59 -05:00
Jason Rice
2b0ede886e [printable] metafunctions 2016-01-18 15:27:00 -05:00
Louis Dionne
9b93fb0eb0 Add experimental views
Closes #193
2016-01-15 10:17:46 -05:00
Louis Dionne
dc90dc52d0 Fix some Boost-inspect errors
- Non-ASCII characters
- Files not ending with a newline
- Missing copyright notices
2016-01-13 12:38:09 -05:00
Louis Dionne
81ddcfafaf Rename take to take_front
This improves consistency:
drop_front/drop_back
take_front/take_back
2016-01-12 10:10:03 -05:00
Louis Dionne
131c56c32a Add the take_back algorithm 2016-01-12 10:00:11 -05:00
Louis Dionne
ca61f12562 Minor refactoring of typos and missing includes 2016-01-12 09:34:36 -05:00
Louis Dionne
d60646237d [core] Rename core/convert.hpp to core/to.hpp 2016-01-10 18:32:57 -05:00
Louis Dionne
5e103af0d7 [tests] Modularize the unit tests for the Sequence concept 2016-01-10 18:00:08 -05:00
Louis Dionne
e1d001cf06 [tests] Modularize tests for hana::metafunction & al 2016-01-10 18:00:05 -05:00
Louis Dionne
7e04b36268 Add BOOST_HANA_ENABLE_DEBUG_MODE and optional checks in make_set and make_map
Closes #230
2016-01-06 09:25:41 -05:00
Louis Dionne
2f38afd499 [tests] Use local Comparable trap_construct utilities in set and map 2016-01-05 20:49:15 -05:00
Louis Dionne
af1c0f7696 [detail] Add unit test for fast_and and refactor unit test for create 2016-01-05 11:11:47 -05:00
Louis Dionne
7f1eeb975a [CMake] Exclude auto tests from the tests.quick target
Running the auto tests cause Appveyor builds to time out.
2016-01-04 17:39:05 -05:00
Louis Dionne
1026267959 [CMake] Modularize the checks for external packages 2016-01-04 14:58:11 -05:00
Louis Dionne
9a1d5551d5 [tests] Move all support headers to the _support subdirectory 2016-01-04 11:18:46 -05:00
Louis Dionne
3c2ecadd15 [tests] Move Github 75 bug to its own directory 2016-01-04 11:18:46 -05:00
Louis Dionne
a4ec52dac0 [type] Modularize the unit tests 2016-01-04 11:18:45 -05:00
Louis Dionne
5e45436bad [canonical_constant] Standardize the unit tests 2016-01-04 11:18:45 -05:00
Louis Dionne
9500798c00 [struct] Modularize the unit tests 2016-01-04 11:18:45 -05:00
Louis Dionne
5e62da18a1 [string] Modularize the unit tests
Also workaround a missing #include in string.hpp
2016-01-04 10:34:18 -05:00
Louis Dionne
3c90ec9012 [set] Modularize the unit tests 2016-01-04 09:47:36 -05:00
Louis Dionne
d5d061469d [tuple] Modularize the unit tests 2016-01-04 09:25:50 -05:00
Louis Dionne
fbe1bc17a5 [range] Modularize the unit tests 2016-01-04 09:25:50 -05:00
Louis Dionne
85bf0a4039 [optional] modularize the unit tests 2016-01-04 09:25:49 -05:00
Louis Dionne
1a34b59558 [map] Modularize the unit tests 2016-01-04 09:25:49 -05:00
Louis Dionne
84977185da Update some copyright notices to 2016 2016-01-04 09:25:49 -05:00
Louis Dionne
2ca3f76e3f Remove workarounds for Boost 1.58 2016-01-04 09:25:49 -05:00
Louis Dionne
d9ade67d55 Modularize tests for drop_while, drop_front and lexicographical_compare 2016-01-04 09:25:49 -05:00
Louis Dionne
325c120918 Add modular tests for many algorithms
drop_back, insert, insert_range, intersperse, partition, reverse,
take, take_while
2016-01-04 09:25:49 -05:00
Louis Dionne
538aea1b50 Add modular tests for group 2016-01-04 09:25:48 -05:00
Louis Dionne
f5ac1659ae Add modular tests for sort 2016-01-04 09:25:48 -05:00
Louis Dionne
2f026a7a3f Add modular tests for span 2016-01-04 09:25:48 -05:00
Louis Dionne
0aed2fcb8c Add modular tests for remove_at 2016-01-04 09:25:48 -05:00
Louis Dionne
fd716089a5 Add modular tests for slice 2016-01-04 09:25:48 -05:00
Louis Dionne
e0cc06608c Add modular unit tests for unique 2016-01-04 09:25:48 -05:00
Louis Dionne
af98fc34d9 Make fusion::deque non-constexpr on Boost <= 1.57 2016-01-04 09:25:48 -05:00
Louis Dionne
77820757b8 [Tests] Start modularizing the unit tests in a more systematic way 2016-01-04 09:25:47 -05:00
Louis Dionne
6492ec66a5 [Tests] Remove some duplicate code in the tests for Fusion 2016-01-04 09:25:47 -05:00
Louis Dionne
c41a5cb6be Update copyright notices for 2016 2016-01-01 14:54:06 -05:00
Jason Rice
b7ee8d750d [bug] predicate to bool in find_if default impl
Related #221
 - decay result of predicate
2015-12-22 11:01:19 -05:00
Louis Dionne
1d57e8669e [std::tuple] Add a test to make sure we workaround libc++ bug 22806 2015-12-21 21:21:37 -05:00
Louis Dionne
28298d2cf1 [CMake] Exclude experimental/printable tests when Boost is missing 2015-12-21 21:14:50 -05:00
Louis Dionne
54ed9450f6 [experimental] Move unit tests for print to the test/ subdirectory 2015-12-20 14:54:38 -05:00
Louis Dionne
af881d3fa2 [Assert] Add xxx_MSG versions of the assertion macros
Fixes #216
2015-12-18 15:04:20 -05:00
Louis Dionne
a723f28650 [detail] Support __VA_ARGS__ in PP_STRINGIZE 2015-12-18 14:17:26 -05:00
Louis Dionne
9d67907d55 [tests] Fix bug uncovered by d93a7c8 2015-12-16 15:36:50 -05:00
Louis Dionne
d93a7c81c3 [if_] Hold branches by reference instead of moving them in 2015-12-16 14:06:55 -05:00
Jason Rice
35449972d3 [bug] convert predicate results to bool
[ldionne: Minor reformatting (add spaces after //)]

Fixes #221
Closes #222
2015-12-16 11:55:24 -05:00
Louis Dionne
95c8d6ab50 [find_if] Support predicates that return an int.
Fixes #221
2015-12-11 15:57:51 -05:00
Louis Dionne
850dbf7ad7 Provide an experimental print function
Closes #200
Closes #219
2015-12-09 14:47:13 -05:00
Louis Dionne
6bff9f2fc0 [map/set] Document and test the copy/move constructors
Fixes #217
2015-12-04 11:04:04 -05:00
badair
87f82e9003 [feature] [UDL] adding UDL logic for hex, binary, octal
[ldionne:
Remove rogue whitespace at the end of lines

Closes #210]
2015-11-20 08:52:55 -05:00
Louis Dionne
0e4b8abe0e [Windows] Disable failing tests due to EBO bug, and fix broken example
The example/tap.cpp bug was actually interesting, so I'll document it
here. We were using `tap` with a function that performed side effects.
However, we relied on the side effects being done in a particular order
for the example to pass. This is a violation of what the documentation
says we're allowed to.

On Windows, the call convention is such that arguments are evaluated
from right to left, instead of left to right like on OS X and Linux.
Since `chain` uses `transform` and `transform` expands `f(x)...` inside
a function call, our function with side effects was being called in
reverse order as what we would have expected!

Morale: Listen to the documentation, or perish.
2015-11-18 20:18:34 -05:00
Louis Dionne
56d4c499ad Use a macro to open and close Hana's namespace
Note, however, that we're not using inline namespaces yet.
Using a macro to open/close the namespace would however make
such a change trivial.
2015-11-17 09:33:21 -05:00
badair
197c152495 [to_xxx] [convert] adding to<xxx> equivalents
- adding to_map
- adding to_set
- adding to_tuple

ldionne:
    Closes #206
    Closes #164
2015-11-16 20:18:08 -05:00
Louis Dionne
4782c8a0b6 [CMake] Simplify and optimize the handling of unit tests and examples 2015-11-14 14:13:27 -05:00
Louis Dionne
1d2e3a682b [CMake] Create a generic module to handle public header testing 2015-11-14 14:13:18 -05:00
Louis Dionne
537e4fe645 [Detail] Avoid EBO-disabling duplicate base classes caused by operators::adl
Fixes #202
2015-11-13 12:23:06 -05:00
Louis Dionne
e13d826496 [MPL] Add support for mpl::list 2015-11-12 14:23:15 -05:00
Louis Dionne
1b64f5e6c9 Revert the two previous commits about EBO on Windows
The commits are db487b2b4 and 76a0ac16a. They were supposed to fix
unit tests failing on Windows due to a missing EBO, but both of these
commits failed to do so. Since I can't test on Windows by myself for
the time being, I'm rolling back these commits and I'll try to fix
this error later.
2015-11-11 20:24:45 -05:00
Louis Dionne
db487b2b42 [Tests] Actually workaround the missing EBO on Windows 2015-11-11 18:00:57 -05:00
Louis Dionne
76a0ac16a4 [Tests] Workaround missing EBO in Clang for Windows 2015-11-11 17:31:37 -05:00
Louis Dionne
3707877225 [Iterable] Remove the tail function
Closes #158
2015-11-11 14:08:36 -05:00
Louis Dionne
7d578de9d8 [Iterable] Reformulate the MCD in terms of drop_front 2015-11-07 16:18:11 -05:00
Louis Dionne
5c2b4f1eb0 [Tests] Do not run the header tests under Valgrind 2015-11-07 12:05:41 -05:00
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