Commit Graph

718 Commits

Author SHA1 Message Date
Peter Dimov
1f9c63c34f Fix MSVC parsing problem in allocate_shared_array 2017-03-01 12:08:17 +02:00
Glen Fernandes
52fbf70879 Special case aligning up sizes and change integral constant style 2017-02-28 19:23:02 -05:00
Glen Fernandes
fb59cd574e Copy rebind allocator before impl destruct 2017-02-28 07:21:49 -05:00
Glen Fernandes
970e88897c Revise make_shared and allocate_shared for arrays 2017-02-28 03:47:09 -05:00
Paul Groke
3bb4e4d2df don't define BOOST_SP_HAS_SYNC for z/OS XL C/C++ compiler 2017-02-25 05:44:04 +01:00
Minmin Gong
d718d21d6b Fix compiling problems under ClangC2. 2017-02-05 15:51:42 -08:00
Chris Glover
3e2ac10e94 Add rvalue versions of static_pointer_cast, const_pointer_cast, dynamic_pointer_cast, reinterpret_pointer_cast.
Aligns with proposed addition to std:: here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0390r0.htm
2016-12-11 15:38:34 -05:00
Peter Dimov
3e61a63f60 Use throw() in place of noexcept on msvc-11.0,12.0 for the standard nothrow traits 2016-11-08 18:42:51 +02:00
Peter Dimov
a7fbb0a841 Do not use components removed in C++17 (auto_ptr, binary_function) 2016-11-06 15:35:46 +02:00
Peter Dimov
5595622c3e Relax dynamic_cast check; rephrase const_cast test to be more MSVC-friendly. 2016-09-10 20:18:37 +03:00
Peter Dimov
2ae3e4ba44 Remove static_pointer_cast restriction; test dynamic cross cast. 2016-09-10 20:07:47 +03:00
Peter Dimov
a14515a364 Add negative pointer cast tests. 2016-09-10 18:43:22 +03:00
Peter Dimov
190c06e25d Add tests for unique_ptr casts. 2016-09-10 17:55:14 +03:00
Peter Dimov
62a8a9d6cc Merge branch 'karo/unique_ptr_casts' of https://github.com/koraa/smart_ptr into feature/unique_ptr_casts 2016-09-10 14:48:26 +03:00
Peter Dimov
48401806f4 Merge branch 'make_shared-constructor-forwarding' of https://github.com/muggenhor/boost-smart_ptr into develop 2016-09-10 14:24:52 +03:00
Peter Dimov
02de302774 Merge branch 'suppress-weak-vtables-warning' of https://github.com/Kojoley/smart_ptr into develop 2016-09-10 13:55:20 +03:00
Peter Dimov
840e9fc96e Apply MIPS16 patch from ticket #12418 2016-09-02 20:13:15 +03:00
Nikita Kniazev
70367e848e Suppress weak vtables warnings 2016-08-31 17:32:09 +03:00
Peter Dimov
20fedcff2c Use <atomic> by default when BOOST_NO_CXX11_HDR_ATOMIC is not defined 2016-08-28 21:28:21 +03:00
Giel van Schijndel
de38a735ea boost::make_shared: use Constructor Forwarding on C++03
Use Boost.Move's move emulation and documented Constructor Forwarding
technique to provide (partial) constructor forwarding on compilers that
don't support r-value references.

This allows constructing types taking movable-but-not-copyable types as
constructor arguments. Additionally it's generally more efficient for
movable-and-copyable types, but that's just a nice-to-have.
2016-07-25 15:02:57 +02:00
Karolin Varner
ce52fb1045 pointer_casts with move semantics for unique_ptr 2016-06-06 16:08:26 +02:00
Karolin Varner
6b787f1cec Add overloads for std::shared_ptr to pointer casts 2016-06-06 14:51:44 +02:00
Peter Dimov
e52905cf3c Add intrusive_ptr converting move assignment. 2016-05-17 18:43:41 +03:00
Peter Dimov
a7ade6f062 Remove unnecessary #ifdef 2016-05-17 18:34:18 +03:00
Peter Dimov
097d2e9bf9 Merge branch 'intrusive_ptr_move' of https://github.com/jtwang83/smart_ptr into develop 2016-05-17 18:29:29 +03:00
Peter Dimov
582eb63cb3 Merge pull request #18 from joachim-faulhaber/smart_ptr_patches_1_59_0
Warning fixes: Conversion and unused parameter warnings
2016-05-17 18:07:32 +03:00
Peter Dimov
da8de3e95b Merge pull request #19 from Lastique/patch-4
Make the default  intrusive_ptr constructor constexpr
2016-05-17 17:59:10 +03:00
Peter Dimov
522f6c1869 Add more aliasing move test cases, add alias move reset 2016-04-13 14:31:43 +03:00
Peter Dimov
cd8de9d4a6 Merge branch 'move-alias' of https://github.com/uecasm/smart_ptr into develop 2016-04-13 13:29:50 +03:00
Glen Fernandes
427124543b Use remove_reference in make_unique implementation 2016-02-19 08:09:25 -05:00
Peter Dimov
4473bf8ec2 Fix hash support for shared_ptr<T[]>, <T[N]> 2015-12-15 19:13:20 +02:00
Glen Fernandes
7a7ac4512e Fix formatting in headers and tests 2015-11-11 01:26:15 -05:00
Glen Fernandes
7af503d3bb Refactor make_unique implementations
Before the pending refactor of make_shared/allocate_shared for arrays.
2015-11-08 11:02:06 -05:00
Ion Gaztañaga
3f17244225 Removed the intrin.h-related part
Removed the commented part as the comment clearly says that VC9 has problems when intrin.h is included.
2015-10-18 19:44:17 +02:00
Ion Gaztañaga
ca93749614 Support MSVC-7.1/ intrin.h available >= MSVC-8.0
-> MSVC 7.1 has no intrin.h and needs to use "#pragma intrinsic".
-> intrin.h available since Visual 2005
2015-10-18 12:51:13 +02:00
Gavin Lambert
05d5a4e9a0 Added shared_ptr aliasing move constructor.
Signed-off-by: Gavin Lambert <github@mirality.co.nz>
2015-10-12 18:19:22 +13:00
Andrey Semashev
970a179ac2 Make the default constructor constexpr 2015-10-05 18:24:52 +03:00
Joachim Faulhaber
fd543d3292 Warning fixes: Conversion and unused parameter warnings 2015-09-24 14:53:40 +02:00
Peter Dimov
df90496583 Disable deprecation warnings on g++/clang 2015-09-10 23:45:47 +03:00
jzmaddock
abbe975e8f Disable explicit operator bool on Oracle C++
Although Oracle supports this syntax, advanced usage such as:

if(my_shared_ptr && x)

Fail.  Attempts to wokaround by adding additional operator overloads have so far failed.
2015-08-18 18:14:50 +01:00
Edward Diener
686efe100b Updated Sleep declaration only includes _mingw.h when needed. 2015-07-22 18:23:43 -04:00
Edward Diener
acb880d8c2 Change to Sleep declaration for clang on Windows to match Windows implementation being used 2015-07-22 06:51:49 -04:00
Edward Diener
1712b87cb6 Added __declspec(dllimport) for Sleep using clang on Windows. 2015-07-21 15:41:35 -04:00
Peter Dimov
a42dda0af4 Apply fix for errata 754327 for ARM Cortex-A9 suggested in ticket #11362 2015-06-06 01:40:01 +03:00
Peter Dimov
d875a68ceb Add constructor/assignment taking boost::movelib::unique_ptr 2015-05-04 01:06:42 +03:00
Jörg Böhme
94824c807f Add missing std:: namespace 2015-03-20 00:23:58 +01:00
Jonathan Wang
334654de06 intrusive_ptr: add converting ctor for intrusive_ptr<U> with move semantics. Analagous to
template <class U> intrusive_ptr(intrusive_ptr<U> const&)
2015-03-15 20:17:55 -04:00
Fedor Sergeev
99762e7dde Add <cstddef> include. fixes #11066 2015-03-01 23:14:28 +04:00
Peter Dimov
7104e7dc7e Add weak_from_this. 2015-01-25 20:10:57 +02:00
Peter Dimov
3fd53ced83 Make shared_from_raw and weak_from_raw return consistent values in a constructor, regardless of order, as suggested by Gavin Lambert in #8. 2015-01-22 20:47:01 +02:00
Peter Dimov
75de3dbcf1 Add clang-specific sp_counted_base. 2015-01-22 05:13:27 +02:00
Peter Dimov
7faec4265b Fix conflicts with the I macro in <complex.h>. 2015-01-21 19:55:42 +02:00
Peter Dimov
a74329794c Fix ambiguous 'detail' errors under msvc-8.0. 2015-01-16 20:53:27 +02:00
Peter Dimov
f65c57d9d2 Fix explicit instantiation regression 2014-11-12 19:04:29 +02:00
Peter Dimov
7b71068b52 Extend nullptr_t workaround to Intel C++. 2014-08-09 00:26:00 +03:00
Peter Dimov
8de3e84021 Fix shared_from_raw_test4 failures. 2014-08-06 21:28:03 +03:00
Peter Dimov
528195233b Merge branch 'aix_fix' of https://github.com/ibmsoe/smart_ptr into develop 2014-07-30 17:51:32 +03:00
Axel Ismirlian
8c49f5a637 Avoid potential conflict between AIX's and Lambda's var.
In ../boost/lambda/detail/lambda_functor_base.hpp there is variable called var that conflicts with an AIX system variable. The entire file (sched.h) does not need to be included only the one function it uses (sched_yield).
2014-07-30 09:23:21 -05:00
Glen Fernandes
88f0a98d71 Rename member because _CRTDBG_MAP_ALLOC in VS does not allow it
_CRTDBG_MAP_ALLOC has issues with member functions named "free".
2014-07-25 20:33:29 -07:00
Andrey Semashev
40387ef654 Fix compilation problems with clang
Apparently, clang presents itself as gcc 4.2 even though it supports the final version of rvalue references. Restrict the workaround to gcc only.
2014-07-16 16:43:35 +04:00
Andrey Semashev
b1beb11a45 Fix warnings on gcc 4.4
Added a special version of sp_forward for an outdated version of rvalue references supported by gcc 4.4. The compiler would create a temporary and return an rvalue reference to it in the original code. This resulted in warnings about 'returning reference to temporary'.

The added version is similar to std::forward on that compiler, except it doesn't prohibit template argument deduction (which is in line with the original sp_forward).
2014-07-14 22:33:16 +04:00
Peter Dimov
bf3e9cc7af -Wshadow fixes. 2014-07-12 20:35:14 +03:00
Peter Dimov
d6841e6d71 Remove trailing whitespace. 2014-06-11 22:29:15 +03:00
Peter Dimov
56ae9f86c1 Merge pull request #4 from stgates/winrt
[winrt support] Replacing banned APIs Sleep and InitializeCriticalSection
2014-06-11 22:12:25 +03:00
Steve Gates
1a74757cfa Adding missing include for boost\predef.h. 2014-06-11 11:44:25 -07:00
Steve Gates
07e222217b Updating to use BOOST_PLAT_WINDOWS_RUNTIME based on review feedback. 2014-06-11 11:33:03 -07:00
Steve Gates
71c9165119 Replacing banned APIs Sleep and InitializeCriticalSection for Windows store and phone. 2014-06-10 22:07:51 -07:00
Peter Dimov
f32669400c Remove headers moved into core. 2014-06-03 20:25:38 +03:00
Peter Dimov
b550e028f5 Move boost/memory_order.hpp to Boost.Atomic 2014-05-20 23:33:03 +03:00
Glen Fernandes
d523c3423e Use Boost.Align for alignment 2014-05-04 08:20:37 -07:00
Glen Fernandes
1968d17d2f Use add_rvalue_reference in make_unique overload 2014-03-12 20:27:36 -07:00
Andrey Semashev
d586469d60 Fix warnings about struct/class mismatch
ms_allocator_state template was declared as class but its specializations were as structs. This caused Clang 3.2 warnings. The commit changes ms_allocator_state declaration to struct to fix that.
2014-03-08 18:31:31 +03:00
Peter Dimov
fbb851097f Disable the std::atomic spinlock implementation on Clang 2014-03-01 02:14:56 +02:00
Glen Fernandes
75add10b1d Simplify ms_allocator and as_allocator design 2014-02-28 10:19:50 -08:00
Peter Dimov
3e625c07e8 Switch to sp_interlocked.hpp 2014-02-25 01:32:19 +02:00
Glen Fernandes
75cab39801 Drop the BOOST_NO_CXX11_STD_ALIGN-undefined path
Until the merge of Boost.Config develop to master
2014-02-24 08:35:59 -08:00
Glen Fernandes
38cb523713 Derive empty base optimization from rebound allocator 2014-02-18 00:16:57 -08:00
Glen Fernandes
5f1d4eae4f Factor out alignment code into sp_align 2014-02-16 12:15:29 -08:00
Glen Fernandes
adc0cdddff Make as_allocator::deallocate consistent 2014-02-14 18:31:52 -08:00
Glen Fernandes
8c9e8b5556 Further simplification of ms_allocator 2014-02-12 22:15:15 -08:00
Glen Fernandes
d9333e5375 Simplify array_allocator; update documentation 2014-02-12 19:34:56 -08:00
Glen Fernandes
3d279e6c6d Save additional sizeof(void*) bytes for arrays 2014-02-12 13:52:58 -08:00
Peter Dimov
c003fba3a0 Renamed, cleaned up interlocked.hpp; added test 2014-02-12 20:48:35 +02:00
Peter Dimov
0c29e86728 Add spinlock_std_atomic.hpp 2014-02-12 20:20:56 +02:00
Glen Fernandes
016af907bd Make sp_counted_impl_ specialization more generic 2014-02-12 08:46:59 -08:00
Peter Dimov
0337743c8c Revert "Remove obsolete MSVC check from pragma guard"
This reverts commit b7ee788845.
2014-02-12 16:57:45 +02:00
Peter Dimov
208bfd78f9 Move interlocked.hpp to smart_ptr/detail 2014-02-12 16:42:24 +02:00
Peter Dimov
2c32bf91b7 Add BOOST_USE_INTRIN_H support; remove #pragma intrinsic, not needed and not supported on Intel.
[SVN r85994]
2014-02-12 16:41:23 +02:00
Stephen Kelly
b7ee788845 Remove obsolete MSVC check from pragma guard
git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq

is now clean.

[SVN r85952]
2014-02-12 16:41:22 +02:00
Andrey Semashev
a56378ee35 Enabled #pragma once for all compilers that support it, not only MSVC.
[SVN r85866]
2014-02-12 16:41:22 +02:00
Andrey Semashev
443302306e Fixed compilation problems with MinGW-w64.
[SVN r85865]
2014-02-12 16:41:21 +02:00
Peter Dimov
f5402a937e Fix the _WIN32_WCE >= 0x600 case.
[SVN r80935]
2014-02-12 16:41:21 +02:00
Jürgen Hunold
fe04bea979 Fix: intrin.h is available in msvc-9.0 (_MSC_VER 1500)
[SVN r80626]
2014-02-12 16:41:21 +02:00
Vicente J. Botet Escriba
8fbb5e9e7f Thread: Try again to fix 5431
[SVN r80127]
2014-02-12 16:41:20 +02:00
Vicente J. Botet Escriba
0401afc106 Thread: Rollback last modification as it breaks regression test VeecoFTC/msvc-9.0~wm5~stlport5.2
[SVN r80067]
2014-02-12 16:41:20 +02:00
Vicente J. Botet Escriba
b69ca7aaa5 Thread: Try to fix 5431
[SVN r80042]
2014-02-12 16:41:19 +02:00
Peter Dimov
dffbf7c931 Use <intrin.h> for VS2010+. Refs #4678.
[SVN r75396]
2014-02-12 16:41:19 +02:00
Anthony Williams
5dabdf635c Applied patch from issue #4849
[SVN r70383]
2014-02-12 16:41:19 +02:00
Anthony Williams
3dbde36076 Applied patch from issue #3377
[SVN r62509]
2014-02-12 16:41:18 +02:00
Peter Dimov
97a9aac5f0 Fix interlocked.hpp to compile under /clr:pure. Refs #3378.
[SVN r57958]
2014-02-12 16:41:17 +02:00
Peter Dimov
bd5b684fd3 Move smart_ptr into boost/smart_ptr/*.hpp (refs #2239).
[SVN r51509]
2014-02-12 16:41:17 +02:00
Peter Dimov
6ede4ec4c6 Factored out boost/detail/lightweight_thread.hpp.
[SVN r44638]
2014-02-12 16:41:16 +02:00
Peter Dimov
aab1328e06 spinlock_nt.hpp added, Cygwin fixes.
[SVN r44055]
2014-02-12 16:41:16 +02:00
Anthony Williams
451c71c1bd Added changes from David Deakins to enable compilation on Windows CE
[SVN r40679]
2014-02-12 16:41:16 +02:00
Peter Dimov
6341b8802a Windows CE patch by Michael Fink
[SVN r33986]
2014-02-12 16:41:15 +02:00
Anthony Williams
e274885fd2 Win32 implementation of boost::timed_mutex
[SVN r33272]
2014-02-12 16:41:15 +02:00
Peter Dimov
82fe5f5095 Fixed a couple of syntax errors (reported by Juergen Hunold)
[SVN r31946]
2014-02-12 16:41:14 +02:00
Peter Dimov
8c50214e3f Fixed bug #1370716, static shared_ptr instances not working w/ quick_allocator
[SVN r31931]
2014-02-12 16:41:14 +02:00
Anthony Williams
21198d07fd Moved BOOST_INTERLOCKED_READ stuff into its own header
[SVN r31098]
2014-02-12 16:41:14 +02:00
Anthony Williams
b4c8cf3958 Removed :: qualification on _Interlocked functions
[SVN r31097]
2014-02-12 16:41:13 +02:00
Anthony Williams
77aeaee7a7 Added BOOST_INTERLOCKED_EXCHANGE_POINTER in all branches of the #if
[SVN r31012]
2014-02-12 16:41:13 +02:00
Anthony Williams
677a0777d2 Added InterlockedExchangePointer
[SVN r31010]
2014-02-12 16:41:12 +02:00
Anthony Williams
7c7250379b InterlockedCompareExchangePointer is only intrinsic on 64 bit platforms, otherwise it's just a synonym for InterlockedCompareExchange
[SVN r30951]
2014-02-12 16:41:12 +02:00
Anthony Williams
142eb95986 Added interlocked compare/exchange for pointers, and interlocked_read for values and pointers
[SVN r30941]
2014-02-12 16:41:11 +02:00
Anthony Williams
d9f24f882e New version of call_once for win32
[SVN r30847]
2014-02-12 16:41:11 +02:00
Peter Dimov
0fd3947e19 <intrin.h> appears broken.
[SVN r27737]
2014-02-12 16:41:10 +02:00
Peter Dimov
43bc30e576 Split sp_counted_base into no threads (nt), win32 lock-free (w32) and pthreads (pt)
[SVN r27729]
2014-02-12 16:41:10 +02:00
Douglas Gregor
e0ec2a0aaa Converted to Boost Software License, Version 1.0
[SVN r24055]
2014-02-12 16:41:10 +02:00
Peter Dimov
5320981cbb _MSC_VER use clarified.
[SVN r20992]
2014-02-12 16:41:09 +02:00
Peter Dimov
d676bac36a -Wundef fixes.
[SVN r18788]
2014-02-12 16:41:09 +02:00
Peter Dimov
ec1c6ed414 Fixes for Comeau with Borland as backend.
[SVN r17588]
2014-02-12 16:41:08 +02:00
Peter Dimov
ce36b11fd5 Made the default page size 512 (g++ 2.96 on Red Hat 7.2 dislikes 496.)
[SVN r17272]
2014-02-12 16:41:08 +02:00
Peter Dimov
eee70bdcab Added BOOST_QA_PAGE_SIZE.
[SVN r17270]
2014-02-12 16:41:07 +02:00
Peter Dimov
97eed20d9b Quick_allocator updates.
[SVN r17267]
2014-02-12 16:41:07 +02:00
Peter Dimov
6b6b63ef37 Dave's quick_allocator added, #define BOOST_SP_USE_QUICK_ALLOCATOR to make shared_ptr use it.
[SVN r17087]
2014-02-12 16:41:07 +02:00
Glen Fernandes
7ce5b6b2a9 Fix use of ms_init in no C++11 allocator case 2014-02-11 08:39:52 -08:00
Glen Fernandes
7e3ae44bc2 Fix use of size in make_shared for arrays 2014-02-10 21:09:13 -08:00
Glen Fernandes
57dc400fbf Cosmetic changes in make_shared and make_unique 2014-02-10 21:04:41 -08:00
Glen Fernandes
5f485c2952 Spatial optimization for make_shared for arrays
Saves up to sizeof(void*) + sizeof(size_t) bytes for make_shared and saves
sizeof(void*) + sizeof(size_t) + sizeof(A) bytes for allocate_shared where A is the
supplied allocator type.
2014-02-10 20:54:48 -08:00
Glen Fernandes
54fb49a5be Use typedef A1 (warnings about unused typedefs) 2014-02-09 11:27:22 -08:00
Glen Fernandes
c23bd41c44 Refactor make_shared for arrays
Refactor implementation to later simplify making an optimization [for the C++11
allocator case] for when sp_counted_impl_pda destruction invokes the
allocator's destroy function instead of the type's destructor.
2014-02-07 08:03:47 -08:00
Peter Dimov
a64cc5c41c Use allocator)traits<>::destroy in sp_counted_impl_pda::destroy 2014-02-07 17:37:00 +02:00
Glen Fernandes
d46e3c7cbd Simplify/tidy array_allocator and array_deleter 2014-02-06 01:38:58 -08:00
Glen Fernandes
6d73b4aa54 Work around VC11 which has broken rebind_traits
VC11 has only partial support for C++11 allocators. For example it has a
non-conforming rebind_alloc and rebind_traits in std::allocator_traits
because it does not support C++11 template aliases.
2014-02-04 23:56:34 -08:00
Peter Dimov
9f5822f427 Add support and test for C++11 construct/destroy in allocate_shared 2014-02-05 02:31:33 +02:00
Peter Dimov
d229ae870c Subsume zero-argument overload into the variadic one 2014-02-05 01:04:20 +02:00
Glen Fernandes
3ac6dbbf08 Make detail::as_allocator template C++11 friendly 2014-02-04 15:00:24 -08:00
Peter Dimov
af5141d492 Merge commit 2014-02-05 00:32:36 +02:00
Peter Dimov
90e74511f7 Add support and tests for C++11 minimal allocators 2014-02-05 00:17:34 +02:00
Glen Fernandes
51ab46a07d Fix use of rebind_traits and rebind_alloc 2014-02-04 12:42:10 -08:00
Glen Fernandes
e8595a05af Fix use of rebind_traits and rebind_alloc 2014-02-04 08:43:36 -08:00
Glen Fernandes
154a274916 Update make_shared for arrays to address 2070
This updates make_shared and allocate_shared for arrays in accordance with
report 2070 which requires that allocator_traits<A2>::construct(a2, ptr,
...) is used for construction and allocator_traits<A2>::destroy(a2, ptr)
is used for destruction instead of placement new and destructor
invocation.
2014-02-04 04:46:03 -08:00
Glen Fernandes
63a05a3576 Refactor make_array_helper and array_deleter
Reduce the amount of code in allocate_array_helper, make_array_helper, and
array_deleter using the empty base class optimization technique.
2014-02-03 07:28:01 -08:00
Glen Fernandes
72e5fb6fd7 Add fourth form of make_unique for objects
To support initialization syntax that Args&&... cannot forward perfectly.
2014-01-29 17:16:01 -08:00
Glen Fernandes
7fef3bb40b Add top-level make_unique.hpp and documentation 2014-01-29 07:25:30 -08:00
Glen Fernandes
7806737b52 Add make_unique for arrays and objects 2014-01-28 03:58:51 -08:00
Glen Fernandes
87e5debdc2 Minor cosmetic changes in make_shared for arrays 2014-01-28 03:40:54 -08:00
Glen Fernandes
630e4f49f3 Update make_shared for arrays to conform to N3870
Update make_shared and allocate_shared for arrays to be confined to the
set of overloads specified in N3870.
2014-01-23 20:40:46 -08:00
Peter Dimov
4de3f36839 Add add_ref parameter to intrusive_ptr::reset, add tests for reset. 2013-12-26 18:47:05 +02:00
Avi Kivity
73153d5797 Add intrusive_ptr<>::detach()
This provides a way to escape from automatic reference counting, and taking
manual control of the reference.  Useful when interfacing to a C API that
expects a pointer with an elevated reference count.

Similar to std::unique_ptr<>::release().
2013-12-26 17:47:28 +02:00