Eric Fiselier
ec6c06610f
Remove unneeded redeclaration of reference_wrapper.
...
llvm-svn: 232887
2015-03-21 06:05:45 +00:00
Eric Fiselier
65500d4b29
[libc++] Try and prevent evaluation of `is_default_constructible` on tuples default constructor if it is not needed.
...
Summary:
Currently parts of the SFINAE on tuples default constructor always gets evaluated even when the default constructor is never called or instantiated. This can cause a hard compile error when a tuple is created with types that do not have a default constructor. Below is a self contained example using a pair like class. This code will not compile but probably should.
```
#include <type_traits>
template <class T>
struct IllFormedDefaultImp {
IllFormedDefaultImp(T x) : value(x) {}
constexpr IllFormedDefaultImp() {}
T value;
};
typedef IllFormedDefaultImp<int &> IllFormedDefault;
template <class T, class U>
struct pair
{
template <bool Dummy = true,
class = typename std::enable_if<
std::is_default_constructible<T>::value
&& std::is_default_constructible<U>::value
&& Dummy>::type
>
constexpr pair() : first(), second() {}
pair(T const & t, U const & u) : first(t), second(u) {}
T first;
U second;
};
int main()
{
int x = 1;
IllFormedDefault v(x);
pair<IllFormedDefault, IllFormedDefault> p(v, v);
}
```
One way to fix this is to use `Dummy` in a more involved way in the constructor SFINAE. The following patch fixes these sorts of hard compile errors for tuple.
Reviewers: mclow.lists, rsmith, K-ballo, EricWF
Reviewed By: EricWF
Subscribers: ldionne, cfe-commits
Differential Revision: http://reviews.llvm.org/D7569
llvm-svn: 230120
2015-02-21 02:30:41 +00:00
Duncan P. N. Exon Smith
53afae49ee
tuple: Make operator<() linear instead of exponential
...
Patch by Matthew Dempsky!
llvm-svn: 226641
2015-01-21 02:51:17 +00:00
Eric Fiselier
53deb607d9
Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.
...
llvm-svn: 222794
2014-11-25 21:57:41 +00:00
Marshall Clow
14c5ec5194
Fixes PR21157 'tuple: non-default constructible tuple hard failure' Thanks to Louis Dionne for the bug report and the patch.
...
llvm-svn: 219785
2014-10-15 10:33:02 +00:00
Marshall Clow
10a65e2ee1
Thanks to K-ballo for noting a second incorrect noexcept clause in tuple - and suggesting a more correct way to write the first
...
llvm-svn: 217884
2014-09-16 17:08:21 +00:00
Marshall Clow
3175f49d33
Fix a bad noexcept clause in tuple's move constructor
...
llvm-svn: 217878
2014-09-16 15:36:14 +00:00
Eric Fiselier
567bb79bf2
D4451: Fix copy/move issues casude by __tuple_leafs's converting constructor
...
llvm-svn: 213888
2014-07-24 18:48:34 +00:00
Marshall Clow
f9af6140ff
Some calls to get<>() were qualified. Some were not. Qualify them all. Fixes bug #20092 . Thanks to Agustín Bergé for the bug report and the fix.
...
llvm-svn: 211563
2014-06-24 00:46:19 +00:00
Marshall Clow
7546a111a9
Default the copy and move constructors for __tuple_leaf. This fixes bugs 18853 and 19118. Add a test case for that.
...
llvm-svn: 206829
2014-04-21 23:48:09 +00:00
Marshall Clow
05c8dad230
Implement LWG Paper n3887: Consistent Metafunction Aliases. This adds std::tuple_element_t<> as an alias for tuple_element<>::type. Clean up the synopsis for tuple_element in <utility> as well.
...
llvm-svn: 202673
2014-03-03 06:18:11 +00:00
Marshall Clow
0d1560e10e
Implement LWG issue 2301: Mark std::tie as constexpr
...
llvm-svn: 202158
2014-02-25 16:11:46 +00:00
Marshall Clow
0724bf6767
Rename ___make_pair_return to __make_pair_return_impl; ___make_tuple_return to __make_tuple_return_impl; and ____iterator_traits to __iterator_traits_impl. Part of a campaign to remove > 2 underscores from libc++. No functionality change.
...
llvm-svn: 198457
2014-01-03 22:55:49 +00:00
Howard Hinnant
4478b25ade
Fix several tuple bugs that were exposed by clang's implementation of CWG 1402. This fixes http://llvm.org/bugs/show_bug.cgi?id=17798 .
...
llvm-svn: 194154
2013-11-06 17:45:43 +00:00
Marshall Clow
de9320aa2b
Implement LWG issue 2275 'forward_as_tuple should be constexpr'
...
llvm-svn: 192038
2013-10-05 18:46:37 +00:00
Marshall Clow
ad864049d6
Remove non-printable chars that snuck in back in July; thanks to Yaron Keren for the catch
...
llvm-svn: 191756
2013-10-01 13:28:20 +00:00
Marshall Clow
50c003b577
Implement uses-allocator construction
...
llvm-svn: 190571
2013-09-12 02:11:16 +00:00
Howard Hinnant
f0544c2086
Nico Rieck: this patch series fixes visibility issues on Windows as explained in < http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html >.
...
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Marshall Clow
75eff74803
Make tuple's constructor and std::get<>(tuple) constexpr. Final stage of fixing bug #16599 . Thanks to Howard for the review and updates.
...
llvm-svn: 186834
2013-07-22 16:02:19 +00:00
Marshall Clow
8bf1f08a2c
Make std::get constexpr
...
llvm-svn: 186525
2013-07-17 18:25:36 +00:00
Marshall Clow
1c682f0f0c
Make std::forward and std::move (and std::move_if_noexcept) constexpr in C++14
...
llvm-svn: 186344
2013-07-15 20:46:11 +00:00
Marshall Clow
e99520c72e
Implement n3584 - Addressing Tuples by Type
...
llvm-svn: 186237
2013-07-13 02:54:05 +00:00
Howard Hinnant
f3b02b17af
Accidentally disallowed explicit tuple conversions when all elements of the tuple can be explicitly converted.
...
llvm-svn: 179467
2013-04-14 00:01:13 +00:00
Howard Hinnant
6e41256f68
No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
...
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant
54d333a601
Rename uses of _ and __ because these are getting stepped on by macros from other system code.
...
llvm-svn: 167038
2012-10-30 19:06:59 +00:00
Howard Hinnant
aeb85680fb
Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you send me a patch to CREDITS.TXT?
...
llvm-svn: 163862
2012-09-14 00:39:16 +00:00
Howard Hinnant
c0937e8add
Appy constexpr to <memory>. Picked up a few missing noexcepts as well.
...
llvm-svn: 159902
2012-07-07 20:56:04 +00:00
Howard Hinnant
8a9ee14803
Apply noexcept to tuple.
...
llvm-svn: 159865
2012-07-06 21:53:48 +00:00
Howard Hinnant
a0f4c45c38
As a conforming extension give tuple a noexcept default constructor conditionalized on its held types.
...
llvm-svn: 159858
2012-07-06 20:50:27 +00:00
Howard Hinnant
a62ebe043e
Give tuple a constexpr default constructor.
...
llvm-svn: 159857
2012-07-06 20:39:45 +00:00
Howard Hinnant
0527c6207a
I believe tuple is still under development in the standard. Daniel Krugler is/will be making convincing arguments that a modified form of LWG 2051 (currently NAD Future) is easily acheivable and desirable. He has demonstrated that a tuple<T...> where all of the T are implicitly convertible from U... should have a tuple constructor that is also implicit, instead of explicit. This would support the use cases in LWG 2051 while not undermining T... with explicit conversions from U.... This check-in is an experimental implementation of Daniel's work. I believe this work to be mature enough to warrant inclusion into libc++. If anyone sees real-world problems that this check in causes, please let me know and I will revert it, and provide the feedback to the LWG.
...
llvm-svn: 153855
2012-04-01 23:10:42 +00:00
Howard Hinnant
fa8df7db88
tuple was accidentally lacking a valid copy assignment operator. It went undetected because I had failed to test assigning from a const lvalue. This fixes http://llvm.org/bugs/show_bug.cgi?id=11921
...
llvm-svn: 150613
2012-02-15 20:13:52 +00:00
Howard Hinnant
a87b5e3446
Fix http://llvm.org/bugs/show_bug.cgi?id=11616
...
llvm-svn: 146881
2011-12-19 17:58:44 +00:00
Howard Hinnant
42b8bb5033
Fix http://llvm.org/bugs/show_bug.cgi?id=11461 . Credit Alberto Ganesh Barbati.
...
llvm-svn: 146345
2011-12-11 20:31:33 +00:00
Howard Hinnant
c206366fd7
Quash a whole bunch of warnings
...
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant
c003db1fca
Further macro protection by replacing _[A-Z] with _[A-Z]p
...
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Howard Hinnant
073458b1ab
Windows support by Ruben Van Boxem.
...
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant
1e31e53fe1
Fix <rdar://problem/10226704>
...
llvm-svn: 141054
2011-10-04 01:25:20 +00:00
Howard Hinnant
ce48a1137d
_STD -> _VSTD to avoid macro clash on windows
...
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant
bc95cf0d5f
Experimental support for a meaningful __is_swappable<T>::value. This does not appear to be strictly needed for correct functioning of the library. If it causes any problems, I'd rather pull it sooner rather than later.
...
llvm-svn: 132421
2011-06-01 19:59:32 +00:00
Howard Hinnant
27d0a2a75d
noexcept for <tuple>. And in the process learned that I had done it wrong for pair's swap. I needed to create an __is_nothrow_swappable<T>::value trait that was smart enought to answer false when __is_swappable<T>::value is false. Otherwise one gets compile-time errors when using pair or tuple of non-swappable types, even if you never try to swap the pair or tuple.
...
llvm-svn: 132204
2011-05-27 19:08:18 +00:00
Howard Hinnant
2a3f1bc13f
tweak for readability (no functionality change)
...
llvm-svn: 124192
2011-01-25 16:31:30 +00:00
Douglas Gregor
912e161ce0
An rvalue reference cannot bind to an lvalue, so static_cast the
...
result of the __tuple_leaf::get() call to an rvalue reference when
returning from tuple's get().
llvm-svn: 124190
2011-01-25 16:14:21 +00:00
Howard Hinnant
465abe92a5
Chandler Carruth changed >> to > > in several places.
...
llvm-svn: 124120
2011-01-24 16:07:25 +00:00
Howard Hinnant
ba31cbdbca
Reduced copying cost of tuple_cat from quadratic to linear.
...
llvm-svn: 121655
2010-12-12 23:04:37 +00:00
Howard Hinnant
7f64810bc8
LWG 1385 [FCD] tuple_cat should be a single variadic signature ( http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#1385 ). This issue is only in Ready status, meaning it is not official, but probably will be this March in Madrid. It was tentatively accepted in Batavia with the previso that Bill and I didn't have any problems implementing it. This is my part of that agreement.
...
llvm-svn: 121619
2010-12-11 20:47:50 +00:00
Howard Hinnant
601afb30ec
LWG 1191
...
llvm-svn: 119545
2010-11-17 19:52:17 +00:00
Howard Hinnant
ef6168357a
LWG 1118
...
llvm-svn: 119541
2010-11-17 19:22:43 +00:00
Howard Hinnant
30ad985b6b
Cleaning up some tuple code.
...
llvm-svn: 114848
2010-09-27 17:54:17 +00:00
Howard Hinnant
789847ddbb
visibility-decoration sweep completed.
...
llvm-svn: 114685
2010-09-23 18:58:28 +00:00