Commit Graph

43 Commits

Author SHA1 Message Date
Louis Dionne
d7efa66130 Remove unused variable warnings with recent Clang 2018-11-09 00:25:30 -08:00
Xiang Fan
95f8f74a2c Enable building boost.hana with VS2107 15.8 (with five source workarounds)
Here is the test result:

 100% tests passed, 0 tests failed out of 1103

Here are the details of the source workarounds:

 1. Active issues we are working on
 a. Multiple copy/move ctors
 VC doesn't correctly handle multiple copy/move ctors.
 The workaround is under macro BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654.

 b. Forward declaration of class template member function returning decltype(auto) (this issue is exposed by a recent change in boost 1.68)
 To deduce the actual return type, the compiler expects the function definition to be on the pending list for temploid, which isn't always the case when generic lambda is involved.
 The workaround is under macro BOOST_HANA_WORKAROUND_MSVC_DECLTYPEAUTO_RETURNTYPE_662735

 2. Issues fixed in the development branch of MSVC
 Parsing template id
 VC sometimes incorrectly parses a comparison operation as a template id.
 The workaround is under macro BOOST_HANA_WORKAROUND_MSVC_RDPARSER_TEMPLATEID_616568.

 3. Issues fixed conditionally
 a. Empty base optimization
 VC doesn't always do EBO (empty base optimization). Changing this will break the ABI of MSVC and we provide a __declspec(empty_bases) to enable EBO.
 We have a blog post on this: https://blogs.msdn.microsoft.com/vcblog/2016/03/30/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/.
 Some tests in hana have static_assert on the size of certain types which relies on EBO being applied:

 hana\test\detail\ebo.cpp
 hana\test\issues\github_202.cpp
 hana\test\pair\empty_storage.cpp
 hana\test\tuple\empty_member.cpp

 The workaround is under macro BOOST_HANA_WORKAROUND_MSVC_EMPTYBASE.

 b. Variadic macro expansion
 The implementation of variadic macro isn't conformant and the macro expansion often results in incorrect result.
 The issue is fixed under /experimental:preprocessor and isn't on by default yet.
 We have a blog post on this: https://blogs.msdn.microsoft.com/vcblog/2018/07/06/msvc-preprocessor-progress-towards-conformance/.

 The workaround is under macro BOOST_HANA_WORKAROUND_MSVC_PREPROCESSOR_616033.

Here is the list of files impacted by the source workarounds:

 BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654
  hana\test\_include\laws\base.hpp
  hana\test\map\cnstr.trap.cpp
  hana\test\set\cnstr.trap.cpp
  hana\test\tuple\cnstr.trap.cpp

 BOOST_HANA_WORKAROUND_MSVC_DECLTYPEAUTO_RETURNTYPE_662735
  hana\test\_include\laws\euclidean_ring.hpp
  hana\test\_include\laws\group.hpp
  hana\test\_include\laws\monad_plus.hpp
  hana\test\_include\laws\monoid.hpp
  hana\test\_include\laws\ring.hpp

 BOOST_HANA_WORKAROUND_MSVC_RDPARSER_TEMPLATEID_616568
  hana\include\boost\hana\basic_tuple.hpp
  hana\include\boost\hana\string.hpp
  hana\include\boost\hana\tuple.hpp

 BOOST_HANA_WORKAROUND_MSVC_EMPTYBASE
  hana\include\boost\hana\basic_tuple.hpp
  hana\include\boost\hana\pair.hpp
  hana\include\boost\hana\tuple.hpp
  hana\include\boost\hana\detail\integral_constant.hpp
  hana\test\detail\ebo.cpp

 BOOST_HANA_WORKAROUND_MSVC_PREPROCESSOR_616033
  hana\include\boost\hana\detail\preprocessor.hpp
  hana\include\boost\hana\detail\struct_macros.hpp

BTW,
1. There are some warnings which I don't fix. I will likely address them in a separate PR. They look legit and don't impact the build and tests.
2. Appveyor currently doesn't provide 15.8 Preview 5 which contains all the compiler fixes we made in the previous months. I plan to update appveyor.yml after Appveyor provides 15.8 RTM.
2018-08-22 16:59:34 -07:00
Louis Dionne
e822fd45d9 [NFC] Work around spurious warning in GCC
Bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81299
2017-07-03 18:49:05 -07:00
shreyans800755
220017be7f [symmetric_difference] Add tests and example for map
Closes https://github.com/boostorg/hana/issues/341
2017-06-19 01:08:35 +05:30
shreyans800755
d70b015cbe [map] Add difference method for map
Closes https://github.com/boostorg/hana/issues/341
2017-06-19 01:08:35 +05:30
shreyans800755
074a5fa420 [map] Add intersection method for map
Closes https://github.com/boostorg/hana/issues/341
2017-06-19 01:08:34 +05:30
Louis Dionne
33565392ea [union_] Document separately for map and set
Related to #299
2017-04-22 17:22:45 -07:00
shreyans800755
47fe8af1f2 [map] Added union_ method to merge two maps 2017-04-22 16:39:13 -07: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
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
9895803ede Bump copyright year to 2017 2017-01-07 14:14:18 -08: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
83f3307ba5 [tests] Clean up messy includes 2016-09-18 13:49:35 -07: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
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
eaa4cd7f8e [map] Reimplement hana::map using a hash table 2016-02-16 15:50:41 -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
75f6be09ce Return references from at, at_key & friends
Resolves #90
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
f0ea20f7e8 [map] Add a default constructor
Closes #197
2016-01-31 14:51:48 -05:00
Louis Dionne
d60646237d [core] Rename core/convert.hpp to core/to.hpp 2016-01-10 18:32:57 -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
1a34b59558 [map] Modularize the unit tests 2016-01-04 09:25:49 -05:00
Louis Dionne
c41a5cb6be Update copyright notices for 2016 2016-01-01 14:54:06 -05:00
Louis Dionne
6bff9f2fc0 [map/set] Document and test the copy/move constructors
Fixes #217
2015-12-04 11:04:04 -05: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
daaba5dfd8 [Map] Provide model of Foldable, improve docs and add insert method.
Fixes #41
2015-04-11 12:09:01 -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
463040d318 [Searchable] Rename find to find_if and lookup to find 2015-03-15 00:18:31 -04:00
Louis Dionne
5433debbf8 [Map] Split unit tests and remove usage of lambda 2015-03-10 09:30:07 -04:00
Louis Dionne
647ad436b0 Reorganize the unit tests and increase the overall coverage. 2014-11-04 08:54:58 -05: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
0c1dd29224 Improve some conversion operators.
- Add perfect forwarding
- Allow Maps and Sets to be created from Foldables instead of Lists
2014-10-04 22:58:39 -04:00
Louis Dionne
2d10fb461a Use minimal includes in unit tests. 2014-09-01 18:14:55 -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
356ee03483 Refactor the unit tests and remove some minimal instances 2014-08-09 17:49:16 -04:00
Louis Dionne
b4cfc58e72 Searchable: flip the order of the arguments of the methods 2014-08-05 16:46:56 -04:00
Louis Dionne
d132db0ebf Use finer grained assertions acknowledging Constants 2014-08-05 10:37:54 -04:00
Louis Dionne
41d6b75bc2 Add the product Type class and make Pair a simple data type 2014-07-28 18:35:57 -04:00
Louis Dionne
97386dfb59 Add the Map data type. 2014-07-19 17:17:14 -04:00