Commit Graph

351 Commits

Author SHA1 Message Date
Antony Polukhin
f34376e115
Merge pull request #66 from Kojoley/partly-mitigate-bad-clang-inlining-decision
Partly mitigate bad Clang inlining decision
2019-05-09 10:01:59 +03:00
Antony Polukhin
b18c22a8ff Revert "Merge pull request #59 from Kojoley/recursive_wrapper-move-constructor-pointer-stealing"
This reverts commit dcbfeb9892, reversing
changes made to 055487c5bb.

Reverts adding a pointer stealing to the recursive_wrapper.
2019-05-01 20:57:40 +03:00
Antony Polukhin
0e122c38fe
Merge pull request #67 from HDembinski/fix_warning
fix for unused argument warning
2019-04-23 08:56:28 +03:00
Edward Catmur
cbdb354a27 Copy variant cvref when determining result type
Ensures that we can e.g. call apply_visitor on a lvalue variant
2019-04-17 15:05:37 +01:00
Hans Dembinski
66ef97f655 fix_warning 2019-04-14 14:02:19 +02:00
Nikita Kniazev
dd9b0c9b84 Partly mitigate bad Clang inlining decision
Because a visitor is wrapped several times during visitation it cases extra
temporaries usage and useless store and loads that can only be optimized if
the `visitation_impl` is inlined into the function that creates the wrapper.
Clang inliner decides not to inline functions even with small-sized switches,
resulting in a poor visitation code. Forceinline mark on those internal functions perceptibly improves the situation, though does not mitigate it
completely.

LLVM ticket https://bugs.llvm.org/show_bug.cgi?id=41491
2019-04-14 04:26:31 +03:00
Antony Polukhin
74ea828cde
Merge pull request #65 from boostorg/feature/std-hash
Add std::hash specialization for variant (refs #49)
2019-04-12 10:55:46 +03:00
Antony Polukhin
7cc18f356c
Merge pull request #63 from Kojoley/do-not-call-abort
Do not call abort in forced_return
2019-04-12 10:54:17 +03:00
Antony Polukhin
dcbfeb9892
Merge pull request #59 from Kojoley/recursive_wrapper-move-constructor-pointer-stealing
recursive_wrapper move constructor pointer stealing
2019-04-12 10:52:35 +03:00
Antony Polukhin
31dcc43faf Add std::hash specialization for variant (refs #49) 2019-04-01 23:45:21 +03:00
Nikita Kniazev
3cc73fe162 Do not call abort in forced_return
Reduces code bloating on Clang and MSVC, saves a branch on GCC.
2019-03-26 04:46:43 +03:00
Gregor Jasny
dd728220b0 static_visitor: Make destructor public
otherwise in C++ 17 mode Clang 8 will complain about the
protected destructor:

```
main.cpp:16:33: error: temporary of type 'boost::static_visitor<>' has protected destructor
    boost::apply_visitor(output{}, v);
                                ^
/usr/local/opt/boost/include/boost/variant/static_visitor.hpp:53:5: note: declared protected here
    ~static_visitor() = default;
    ^
```

See also discussion in https://reviews.llvm.org/D53860
2019-03-09 15:25:03 +01:00
Nikita Kniazev
32794c2340 More work done 2019-02-24 00:21:54 +03:00
Nikita Kniazev
754eaf824f Updated the documentation 2019-02-16 18:55:42 +03:00
Nikita Kniazev
af07139502 refine precondition check to a function 2019-02-09 16:20:26 +03:00
Nikita Kniazev
3e93fd428c followup to recursive_wrapper pointer stealing
- Added macro to switch to the old behavior
  - Added valueless_recursive method
  - Removed nullptr and exchange

TODO:
  - Docs
2019-02-08 20:19:21 +03:00
Nikita Kniazev
1364d3ff5f recursive_wrapper move constructor pointer stealing
Instead of allocating a new object just steal the pointer from the other
recursive_wrapper. It is much cheaper and allows to mark the move constructor
noexcept (allows variant to move the object without backup copying it).
2019-01-31 21:15:10 +03:00
Antony Polukhin
d069511e31 Update copyright 2019-01-17 13:00:51 +03:00
Nikita Kniazev
06b643df31 Cleanup includes 2019-01-06 22:15:45 +03:00
Nikita Kniazev
3c5a67e48f Removed EDG 3.2 workaround
EDG 3.2 is pretty old (the workaround added 16 years ago).
2019-01-06 20:31:18 +03:00
Nikita Kniazev
c4370b2da2 Removed NO_VOID_RETURNS workaround
The workaround is obsolete, from Boost.Config it looks like it was used for
very old EDG2.4, VC6, and other compilers in VC6 emulation mode.
2019-01-06 00:42:58 +03:00
Nikita Kniazev
4b37f9b804 Fixed visitor result type deduction at rvalue ref operators 2019-01-05 19:54:20 +03:00
Louis Dionne
1c4d882685 Rewrite the deduction of visitor return type
This avoids using boost::declval inside evaluated contexts, which is invalid
and will actually be diagnosed by compilers [1] when the type used inside
boost::declval has internal linkage (such as an anonymous namespace).

[1]: https://bugs.llvm.org/show_bug.cgi?id=35842
2018-11-15 18:55:58 -05:00
Antony Polukhin
50e7df744a Add missing BOOST_SYMBOL_VISIBLE to the bad_visit exception type 2018-09-18 22:41:48 +03:00
Antony Polukhin
e5a75bb8e1 Revert "Specialize std::hash for boost::variant. Fixes #49"
This reverts commit d972192e54.
2018-08-12 20:56:40 +03:00
Antony Polukhin
d972192e54 Specialize std::hash for boost::variant. Fixes #49 2018-08-12 20:36:12 +03:00
Antony Polukhin
98b5d42e6d Do substitute function arguments on compilers with variadic templates support (more fixes for the #42) 2018-02-21 23:10:25 +03:00
Antony Polukhin
b8149a3a77 Tests and minor fixes for #42 2018-02-20 22:20:24 +03:00
Antony Polukhin
65477fa1ae
Merge pull request #46 from Kojoley/fix-variadic-substitute
Fixed variadic substitute
2018-02-20 21:54:32 +03:00
Nikita Kniazev
b91d4aa40b Fixed variadic substitute 2018-02-17 21:42:31 +03:00
Nikita Kniazev
9dc4f7d697 boost/math/common_factor_ct.hpp is deprecated 2018-02-17 20:49:48 +03:00
Antony Polukhin
30f57614d3
Merge pull request #40 from paweldac/develop
Perfect forwarding for passing visitor in apply_visitor.
2018-01-23 10:39:28 +03:00
Adam Wulkiewicz
6f66a90b47
Add missing include in apply_visitor_binary.hpp
For boost::is_lvalue_reference.
2017-11-20 19:50:41 +01:00
Pawel Dac
33784034b7 Perfect forwarding for passing visitor in apply_visitor.
Allows to catch Visitor&&, Visitor& and const Visitor&.

Removed apply_visitor with const Visitor& since it was catching inlined Visitors&&.
Passing const Visitor to result_wrapper resulted in compilation error when Visitor was mutable.
2017-11-07 23:44:43 +01:00
Antony Polukhin
2d09012977 Always include enable_if in apply_visitor_binary 2017-10-24 09:04:31 +03:00
Antony Polukhin
6caaa65563 Fixes for function ref quallifires usage 2017-10-22 22:25:54 +03:00
diplay
f87445832e change typename template parameter to bool 2017-10-17 11:43:44 +03:00
diplay
49e4f90e74 cpp14 multivisitors tests and fix 2017-10-13 15:09:21 +03:00
diplay
1cf3d885bc binary c++14 rvalue move semantics 2017-10-13 14:33:54 +03:00
diplay
3cab439be0 unary c++14 rvalue move semantics 2017-10-13 14:22:55 +03:00
diplay
ec3c0964f1 [wip] c++14 multivisitor with rvalue support 2017-10-13 12:24:30 +03:00
diplay
d933b7cf01 [wip] fix multivisotors cpp11 2017-10-13 12:14:42 +03:00
diplay
61c3872905 [wip] fixed multivisitor with move semantics 2017-10-13 11:24:00 +03:00
diplay
c15f85475e [wip] trying to make rvalue multivisit work 2017-10-13 01:24:53 +03:00
diplay
51f5b50dc9 [wip] binary apply visitor move semantics 2017-10-12 14:00:54 +03:00
diplay
6d0566898e [wip] fix test crashes from previous commit 2017-10-11 16:33:58 +03:00
diplay
09bbcadbc1 [wip] unary visit with rvalue references 2017-10-11 14:45:56 +03:00
diplay
18fb1d3d7f rvalue and const lvalue reference visitables for multivisitors 2017-10-10 12:37:55 +03:00
diplay
ce556f3371 reduce copy-paste 2017-10-10 12:08:08 +03:00
diplay
86142eccda ticket #6971 fix 2017-10-09 17:47:27 +03:00