Commit Graph

1208 Commits

Author SHA1 Message Date
Jason Rice
6d086796a3 [index_if] New index_if function
- Adds index_if
    - Rewrites detail::index_if to use recursive alias stuff
      optimized for tuple and basic_tuple
    - find_if now uses index_if for Iterables
    - at_key now uses index_if for Sequence
    - Removes duplicate code and unnecessary special case implementations
        - detail::advance_until
        - at_key::advance_until
        - tuple_tag implementation of find_if
    - Uses Foldable instead of Sequence for cases where length is known.
      (find_if had a specialization when Iterable and not Sequence)
    - Adds test.*.auto.index_if for Sequences
    - Adds test support/counter for testing infinite iterables
2017-04-07 16:19:52 -07:00
Louis Dionne
5901d52cd2 Rename struct_macros.erb.hpp to struct_macros.hpp.erb 2017-03-30 10:22:08 -07:00
Louis Dionne
7f2a329800 Bump version to 1.1.0 2017-02-25 13:44:37 -08:00
Louis Dionne
bd8bdefa3a [map] Add restricted assignment operators 2017-02-21 23:32:51 -08:00
Louis Dionne
55bb4b9877 [map] Fix overly loose constructors 2017-02-11 15:40:42 -08:00
Louis Dionne
c3789c70cb [basic_tuple] Use ebo instead of elt to implement EBO in basic_tuple 2017-02-11 15:40:42 -08:00
Louis Dionne
711e6de58a [basic_tuple] Use at_c instead of get_impl to access basic_tuples
This commit decouples the underlying representation of basic_tuple from many
utilities and containers in Hana. This will lead to better support for EBO and
cleaner code, however it might result in a slight compile-time pessimization
since there's one more function instantiation than using `get_impl` directly,
and we're adding 3 overloads to `at_c`.
2017-02-11 15:40:42 -08:00
Louis Dionne
279dbaa9b5 [pair] Ensure that a pair of empty objects is empty too
Also, fix some overly loose constructors
2017-02-11 15:40:42 -08:00
Louis Dionne
40ca5afd7d Add a building block for EBO in containers 2017-02-11 10:26:56 -08:00
Louis Dionne
268004e953 Remove some usages of variable templates 2017-02-07 21:27:28 -08:00
Louis Dionne
323b657bbe [type] Improve rationale for the representation of hana::type
In response to #319
2017-02-05 13:41:16 -08:00
Louis Dionne
a39d2fb90c [any_of] Fix a bug where we called the predicate once more than necessary
Also, add automatic unit tests for any_of, all_of and none_of. This commit
also makes it easier to add new automatic unit tests by documenting a small
shell script.

Commit triggered by http://stackoverflow.com/q/42012512/627587
2017-02-03 13:58:08 -08:00
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
e6d5d59ace Bump version number to 1.0.3 to match next expected release 2017-01-07 14:05:51 -08:00
Louis Dionne
46e9e0ab1f [tuple] Fix ambiguous specialization on GCC 2016-12-10 19:19:29 -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
9fce3542c5 Silence -Wshadow warnings in Hana's headers
Warnings still trigger in the tests and examples, but not in the code of the
library itself.

Fixes #298
2016-12-04 16:49:35 -08:00
Louis Dionne
1eebdb62cb [string] Document the default constructor 2016-12-03 20:53:04 -08:00
Louis Dionne
874f256298 [detail] Remove the dependent_on helper 2016-12-03 16:53:13 -08:00
Johel Ernesto Guerrero Peña
3b51c8b021 [doc][NFC] Documentation fixes 2016-12-01 12:34:55 -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
b87213e15f [concept.hpp] Add missing concept Hashable to the master include 2016-11-17 08:41:00 +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
a897cb9c3f [type] Fix documentation for metafunction & friends, which do not accept raw objects
This should have been fixed in b1696fe, when we removed support for this.
2016-10-23 14:40:56 -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
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
031b145a4d Fix mismatching declarations of _c UDL 2016-09-28 12:28:34 -07:00
Louis Dionne
96d0fe11a7 Remove some usages of variable templates 2016-09-28 10:35:58 -07:00
Louis Dionne
e452c98015 [doc] Reformulate the laws for Comparable to avoid confusion 2016-09-28 08:12:52 -07:00
Louis Dionne
32080fefa0 [NFC] Silence Doxxygen warning 2016-09-28 08:09:54 -07:00
Louis Dionne
14bb149755 Improve error message for non-Comparable types 2016-09-27 08:53:07 -07:00
Louis Dionne
36eb9a0aaf [print] Improve compiler error when called on a non-Printable 2016-09-12 19:36:41 -07:00
Louis Dionne
6158a36985 [decltype_] Fix typo 2016-09-12 19:27:56 -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
6e95221408 Bump to next expected version, 1.0.2 2016-08-30 18:04:01 -07:00
Louis Dionne
9c4c84b383 [v 1.0.1] Bump version for Boost 1.62.0 2016-08-24 13:58:22 -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
e4a3ce2666 [Travis] Update Doxygen version
Also, add some @cond and @endcond blocks to remove stupid Doxygen warnings.
Doxygen really can't parse C++ properly, can it?
2016-07-08 13:46:39 -07:00
Louis Dionne
5d55918535 Remove micro-benchmarks from the documentation, and mention Metabench
Metabench now contains almost all of Hana's algorithms, so we document
the existence of Metabench instead of redundantly generating the
benchmarks on Travis for Hana only.
2016-06-26 09:52:08 -07:00
Louis Dionne
7757ac7d50 [map::at_key] Improve error message when the key is missing
Motivated by #290
2016-06-19 18:03:57 -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
Vittorio Romeo
427cc202d6 Use hana::detail::decay instead of std::decay in implementation
* In implementation code, occurrences of `typename std::decay<...>::type` have
  been replaced with `typename hana::detail::decay<...>::type`.

* The rationale for this change, as mentioned in #282, is that
  `hana::detail::decay` performs better than `std::decay` in "libc++".
  I also think that using the same `decay` implementation throughout the
  library is more consistent.

[ldionne: wrap commit message at 80 columns and squash 3 commits
Closes #284
]
2016-06-12 12:31:44 -07:00
Vittorio Romeo
2641844267 Change return type of single-argument overload to typename detail::decay<F>::type 2016-05-29 09:53:06 -07:00
Vittorio Romeo
89755947fa [overload_linearly] Allow overload_linearly to be called with a single argument
Added an `make_overload_linearly_t::operator()` overload that takes a
single argument, and simply returns the argument

[ldionne: wrap commit message]
2016-05-29 09:52:28 -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
9082e9ff05 [version] Bump to 1.0.0 2016-03-20 10:32:23 -04:00
Louis Dionne
8bec9806b2 [version] Improve formulation of comment. NFC 2016-03-20 10:29:01 -04:00
Louis Dionne
63c5f87dfd [GCC] Update warnings and documentation to support GCC 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
036275f615 [tuple] Remove useless @cond 2016-03-05 14:22:03 -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
aa47c09a55 [map] Use a basic_tuple for storage 2016-02-29 10:42:47 -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
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
b84be1dcca Bump version to 0.8.0 2016-02-27 14:36:56 -05:00
Louis Dionne
70c61dcfca [set,map] Add Hashable and Comparable requirement to the keys of a set
That will allow us to implement the set using a hash table in the future.
2016-02-21 10:47:38 -05:00
Louis Dionne
c30c0f3c8d [optional] Specify the template parameters of optional
Closes #254
2016-02-21 10:24:32 -05:00
Louis Dionne
477368ed8b [hash_table] Add a peephole optimization for 1-element buckets
This optimization shaves off approximately 1 second on the
at_key.number_of_lookups benchmark when looking up 140 elements.
2016-02-19 16:42:34 -05:00
Louis Dionne
5a5eb6548e [traits] Remove usage of decltype_t in traits.
These should have been removed in b1696fe, which removed implicit
support for decltype_ when calling metafunctions.
2016-02-19 16:34:43 -05:00
Louis Dionne
1e3b166c56 [doc] Properly mark more template parameters as implementation-defined 2016-02-19 16:33:16 -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
f068f2d092 [doc] Remove experimental::types from the main "Data types" section 2016-02-18 13:00:57 -05: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
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
18346fd8a1 [doc][value] Add note about value being an overloaded function 2016-02-12 12:42:19 -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
80b78deee1 [doc] Fix typos in integral_constant 2016-02-07 11:30:29 -05:00
Louis Dionne
75f6be09ce Return references from at, at_key & friends
Resolves #90
2016-02-05 18:19:23 -05:00
Louis Dionne
da0c4975da Use T const& instead of T&& for keys in find and at_key
Using T&& is pointless and it makes the code slightly more complex.
2016-02-05 18:19:23 -05:00
Jason Rice
bae4dc1d8d [documentation] operator documentation 2016-02-05 18:14:17 -05:00
Louis Dionne
91b7977df3 [map] Make the template parameters of hana::map implementation-defined
Also, use implementation_defined instead of implementation-defined
as a keyword in the documentation, since implementation-defined is
sometimes mis-rendered by Doxygen.
2016-01-31 15:05:18 -05:00
Louis Dionne
f0ea20f7e8 [map] Add a default constructor
Closes #197
2016-01-31 14:51:48 -05:00
Louis Dionne
c8a886d649 [sort] Reimplement sort with a type-level insertion sort 2016-01-27 18:20:53 -05:00
Louis Dionne
65e1aa850f Add benchmarks for the sort algorithm 2016-01-27 16:15:43 -05:00
Louis Dionne
bfbb9f826c [sort] Make the requirements of the predicate more strict 2016-01-27 16:15:43 -05:00
Louis Dionne
73a7c5aba9 [benchmarks] Add benchmarks for at_key and find_if
Also slightly improve the benchmarking framework:
  - Allow passing an additional environment to benchmarks
  - Add the directory of the .erb.cpp file to the include path
  - Output stdout when a compilation error occurs
2016-01-25 20:11:50 -05:00
Louis Dionne
c34f0d0f61 [doc] Add a link to the section on tag-dispatching from hana::when
Addresses a question asked on Gitter.
2016-01-22 07:55:38 -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
6f1d408c00 [doc] Turn concepts into groups in the documentation
Fixes #133:
    Each function now automatically documents the file where it is
    declared.

Partially addresses #233:
    The alphabetical index now works properly
2016-01-12 11:01:30 -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