Commit Graph

991 Commits

Author SHA1 Message Date
Louis Dionne
68e5998b3c [map] Provide a custom implementation of hana::contains
This should be faster than using the default implementation, which uses `any_of`.
2017-01-29 11:13:10 -08:00
Louis Dionne
c800311cae [set] Add and document a default constructor
Prompted by a StackOverflow question [1], and also the fact that hana::map
supports it.

[1]: http://stackoverflow.com/q/41818061/627587
2017-01-24 08:37:04 -08:00
Louis Dionne
9895803ede Bump copyright year to 2017 2017-01-07 14:14:18 -08:00
Louis Dionne
9d1890ec49 [tuple] Add better SFINAE to guard the variadic constructor
This avoids instantiating rogue constructors in some corner cases.
2016-12-10 16:59:20 -08:00
Louis Dionne
1eebdb62cb [string] Document the default constructor 2016-12-03 20:53:04 -08:00
Louis Dionne
b94551b1b8 [pair] Add better tests for copy/move ctor from pair with convertible members 2016-12-03 17:59:06 -08:00
Louis Dionne
7a3e0480d4 [string] Add a model of the Monoid concept
Fixes #117
2016-11-17 13:19:58 +01:00
Louis Dionne
9fe9d2f0d7 Make sure concepts inherit from an integral_constant
Fixes #269
2016-11-17 08:41:27 +01:00
Louis Dionne
9657c09f68 [map] Properly constrain the variadic constructor, and remove unused ctors 2016-11-16 05:05:19 +01:00
Louis Dionne
e3e8736aab [map] Allow declaring maps using map<Pairs...>, and provide a variadic constructor 2016-11-14 18:56:22 -08:00
Louis Dionne
90ae512da6 [string] Add a c_str() method 2016-11-08 06:57:58 -08:00
Louis Dionne
9f19b9576f [types] Use the __type_pack_element intrinsic to optimize type lookup 2016-11-04 17:13:59 -07:00
Louis Dionne
477d15e7e3 Disable the type_name test for Clang < 3.6 2016-10-23 11:59:29 -07:00
Louis Dionne
c97f86e17b [tests] Remove occurences of using namespace boost::hana 2016-10-23 11:59:28 -07:00
Jason Rice
ea571a11fc Fix Github Issue 304
- Apparently std::array operator[] returns an lvalue reference when unpacking
    a temporary std::array. Using std::get<n> returns the
    proper reference type in the case of rvalues.
  - Adds test by ldionne
2016-10-23 11:59:02 -07:00
Louis Dionne
772df8e7a3 [CMake] Rewrite the TestHeaders module 2016-10-10 20:52:54 -07:00
Louis Dionne
8f8794fd28 [CMake] Add the hana interface library
Also, simplify the example/test setup by removing the tests.quick target
2016-10-10 20:52:54 -07:00
Louis Dionne
429ec2be78 [CMake] Fix the condition for enabling the experimental type_name test 2016-10-10 20:51:42 -07:00
Louis Dionne
07d427a55f [CMake] Do not remove the experimental type_name test on AppleClang 2016-10-09 14:26:08 -07:00
Louis Dionne
8fda2f482e [tests] Take by && instead of value when creating a ::seq
Closes #302, although I suspect #302 is caused by a codegen bug in Clang.
2016-10-08 15:55:13 -07:00
Louis Dionne
16c8dd84c6 [tests] Allow overriding TRACKED_PRINT_STUFF from an including file 2016-10-08 14:40:14 -07:00
Louis Dionne
3930c150e3 [tests] Remove support for subparts in the Sequence laws
The subparts were not used anywhere anymore.
2016-10-08 14:22:02 -07:00
Louis Dionne
6b99094b17 [tests] Inherit from integer instead of using alias to improve error messages 2016-10-08 14:18:15 -07:00
Louis Dionne
f537928be1 Fix experimental::type_name, which is only supported on Clang 2016-10-03 20:15:33 -07:00
Louis Dionne
0ef96e14d6 [experimental] Implement compile-time type names 2016-10-02 18:51:03 -07:00
Louis Dionne
f06b35db8d [tests] Remove includes of the master header 2016-09-18 16:16:25 -07:00
Louis Dionne
83f3307ba5 [tests] Clean up messy includes 2016-09-18 13:49:35 -07:00
Louis Dionne
28f5a6bf74 [tests] Clean up some tests using ::Tracked 2016-09-18 12:12:55 -07:00
Louis Dionne
814a704d7f [CMake] Simplify the unit test CMakeLists 2016-08-30 21:54:12 -07:00
Louis Dionne
474484eed0 [tests] Split Foldable MCD tests 2016-08-30 21:46:35 -07:00
Louis Dionne
497604d4db [tests] Split unit tests for std::array 2016-08-30 21:28:49 -07:00
Louis Dionne
57d0882d2e [tests] Split unit tests for mpl::list and mpl::vector 2016-08-30 21:18:28 -07:00
Louis Dionne
c90e90b5bb [tests] Split unit tests for std::integral_constant 2016-08-30 20:59:05 -07:00
Louis Dionne
f240a9f9f2 [tests] Split unit tests for mpl::integral_c 2016-08-30 20:47:03 -07:00
Louis Dionne
221a9b8d52 [tests] Use ::value instead of {} in implicit constexpr conversion 2016-08-30 19:18:27 -07:00
Marcel Raad
1b005c5679 Unblock testing with MSVC
MSVC doesn't like the #warning directive and issues a fatal error.
It also sets _MSVC_LANG to 201402 for C++14 instead of __cplusplus,
but that's the minimum value anyway.
It also doesn't like using {} instead of ::value for some type traits
sometimes and issues an error about a missing default constructor.

[ldionne: add full break after first line in commit message]
2016-08-30 19:15:27 -07:00
Louis Dionne
fe8d0a6957 [detail] Rename detail::swap to workaround ADL issue
Fixes #297
2016-07-29 09:10:14 -07:00
Louis Dionne
edbbffeea4 [type] Add hana::typeid_ and deprecate hana::decltype_
Closes #290
2016-07-17 17:28:57 -07:00
Louis Dionne
b8e28e4a74 [tests] Create an automatic test for for_each 2016-07-07 21:36:11 -07:00
Louis Dionne
b0d9676370 Fix obscure segfault with boost::tuple on Xcode 7.3 2016-06-19 12:28:09 -07:00
Louis Dionne
26a5b60906 [GCC] Workaround spurious unused variable warnings 2016-06-17 16:50:43 -07:00
Louis Dionne
8f5e660e51 Add a default constructor to reverse_partial
Fixes #260
Closes #261
2016-06-14 07:43:37 -07:00
Jason Rice
a5989ca190 [overload_linearly] test unary function call 2016-05-29 09:53:06 -07:00
Louis Dionne
3ccd7b5fd9 [types] Accept non-metafunctions returning references to types in transform
Fixes #266
2016-04-06 18:42:21 -04:00
Louis Dionne
b440aa8758 [issues/github_234] Use an explicit signed char
This fixes the test on platforms where char is unsigned, where the
original test couldn't (and shouldn't) pass, because `char -> int`
is not an embedding (signed -> unsigned).
2016-03-07 16:46:08 -05:00
Louis Dionne
ec74204588 [scans] Fix undefined behaviour in scan_right and optimize both algorithms 2016-03-05 16:41:47 -05:00
Louis Dionne
9253764b5e [GCC] Workaround GCC bug 47226 2016-03-05 10:50:14 -05:00
Louis Dionne
7c0d6bd23e [test/is_valid] Remove invalid usage of member template in local class 2016-03-04 12:38:27 -05:00
Louis Dionne
6d364970cc [map] Optimize make_map by requiring distinct hashes
This allows us to create large maps quite efficiently. If one needs
to create a map with duplicate keys or keys whose hashes may collide,
the inefficient to_map can be used instead.
2016-02-29 10:55:01 -05:00
Louis Dionne
9398b89210 [test/take_back] Rename misnamed automatic take_back test files
Also use smaller sequences to accommodate boost::tuple.
2016-02-29 10:24:26 -05:00
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