Commit Graph

71 Commits

Author SHA1 Message Date
Louis Dionne
9895803ede Bump copyright year to 2017 2017-01-07 14:14:18 -08: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
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
23c3edc93b [NFC] Un-Doxygenize comments in non-header files 2016-02-04 11:07:41 -05:00
Louis Dionne
aae8559d8a [test] Add unit tests for is_embedded 2016-01-25 23:20:07 -05:00
Louis Dionne
d60646237d [core] Rename core/convert.hpp to core/to.hpp 2016-01-10 18:32:57 -05:00
Louis Dionne
c41a5cb6be Update copyright notices for 2016 2016-01-01 14:54:06 -05:00
Louis Dionne
cf56c3ab83 [Doc] Document new-style concepts and remove core/models.hpp 2015-09-05 19:27:38 -04:00
Louis Dionne
b9d0f6d2d1 [integral_constant] Rename IntegralConstant to integral_constant_tag 2015-09-03 13:29:17 -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
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
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
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
a5245c0a72 [Core] Fix weird compilation error with is_an on Clang 3.5 2015-05-26 15:12:44 -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
589425a6dd [Core] Make has_operator an IntegralConstant
Fixes #51
2015-04-22 07:35:11 -04:00
Louis Dionne
065b910128 Update copyright year. 2015-03-03 14:16:50 -05:00
Louis Dionne
734f89190c [Core] Refactor the operator system 2015-02-20 11:05:44 -05:00
Louis Dionne
f0c66b31f8 Remove outdated core/ tests and reorganize tests 2015-02-20 11:05:44 -05:00
Louis Dionne
9ddad3dc22 [Orderable] Split completely 2015-02-10 18:04:30 -05:00
Louis Dionne
61d59eff57 [Core] Refactor the conversion system, hana::common and add hana::default 2015-02-10 18:02:32 -05:00
Louis Dionne
ee648c2bda [Core] Fix issue with when_valid 2015-02-04 23:02:04 -05:00
Louis Dionne
4654c6786a Split instances for foreign types 2014-12-06 16:30:16 -05:00
Louis Dionne
8845b2a0c1 Use common to provide inter data type instances. 2014-11-17 10:05:58 -05:00
Louis Dionne
f4e9062d89 Core: add the common utility 2014-11-17 09:13:48 -05:00
Louis Dionne
12bb5b1fa4 Core: refactor convert 2014-11-17 09:13:36 -05:00
Louis Dionne
8756e81977 Add boost/hana/config.hpp and BOOST_HANA_*_CHECK macros. 2014-11-10 17:52:33 -05:00
Louis Dionne
0f0c2c4430 Replace when<is_valid<...>> by when_valid<...> 2014-11-07 15:41:10 -05:00
Louis Dionne
049046478e Move ASSERT macros out of the details 2014-11-04 09:43:44 -05:00
Louis Dionne
eddece8d00 Use the nested hana struct to define enabled operators. 2014-10-27 16:31:03 -04:00
Louis Dionne
cc8455dd65 Use the nested hana struct to instantiate unary type classes. 2014-10-27 16:14:02 -04:00
Louis Dionne
220d92ed82 Use a nested hana struct to customize stuff inside user defined objects. 2014-10-27 15:24:14 -04:00
Louis Dionne
b26406d649 Simplify the header hierarchy: too modular isn't good.
This essentially undo parts of 307d3d0. While it seemed a like good
idea to over-modularize type classes to reduce header dependencies, I
think it was a mistake. What 307d3d0 did was basically split each of
the components of a type class into a single header (typeclass/operators.hpp,
typeclass/mcd_1.hpp, typeclass/mcd_2.hpp, ...).

At first, it resolved many weird header dependency glitches. However, it
also made everything more complex; creating even easy type classes was
sometimes much longer than it should have been, and using type classes
was tricky because you had to know exactly what to include. It also went
against the idea of implicit type class instances being provided whenever
that's possible, which I think is a nice feature of the library. Being
dissatisfied with this, I opted for a simpler header organization with
a fwd/ directory that contains forward declaration headers, and everything
else in the same directory.

A possible objection to this change would be that you are now forced
to include sometimes more than what you strictly need when e.g. defining
an instance or using only some instance(s) of a data type. My answer to
this is that Hana is a really small library and the parsing is not
going to have a huge impact on overall compilation time. My bet is that
the time that will be saved by programmers with a simple header hierarchy
outweights the parsing time by far.
2014-10-25 09:47:05 -04:00
Louis Dionne
a7b28bddd8 Add more perfect forwarding and do some refactoring. 2014-10-02 21:05:01 -04:00
Louis Dionne
3bb1bb9c6b Allow instantiating unary type classes from a data type. 2014-09-08 22:39:10 -07:00
Louis Dionne
3da09cc73e Core: is_a also allows checking for data types 2014-09-03 09:21:59 -04:00
Louis Dionne
fadb7a2af0 Core: document how operators work. 2014-08-29 11:18:26 -04:00
Louis Dionne
cbeb6ae983 Core: add the make function 2014-08-25 12:33:49 -04:00
Louis Dionne
c4e4313c8e Remove the Foreign data type.
The Foreign data type made stuff like `to<int>` become
`to<Foreign<int>>`, which is not as clean.
2014-08-25 12:33:48 -04:00
Louis Dionne
307d3d0ec8 Huge reorganization and refactoring.
- Split type class instances into separate files
- Instances provided automatically by a type class are actually MCDs
- Test each instance in a single file, not one file per method
- Refactor the operator system to fix the ADL-related bug.
2014-08-18 19:26:29 -04:00
Louis Dionne
a6b978064b Uncover a bug with ADL-enabled operators 2014-08-16 14:25:57 -04:00
Louis Dionne
2b76377f91 Core: replace when_valid by when + is_valid 2014-08-07 22:38:54 -04:00
Louis Dionne
b6cef58ca1 Core: add are to make it prettier when there are many data types. 2014-08-05 19:52:44 -04:00
Louis Dionne
d132db0ebf Use finer grained assertions acknowledging Constants 2014-08-05 10:37:54 -04:00
Louis Dionne
e9dfdeb57b Core: merge instantiates into is_a for the same functionality 2014-07-31 13:00:57 -04:00
Louis Dionne
b61dfc00a6 Core: document header structure and use when<> in datatype<> 2014-07-31 11:41:42 -04:00
Louis Dionne
8a8ff797ab Split Core into subdirectories to reduce dependencies. 2014-07-30 11:15:26 -04:00