mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-10-07 05:01:00 +02:00
Merged revisions 81700,81703 from trunk:
Add overloads of make_shared and allocate_shared for arrays for E&& where E is typename boost::detail::array_base<T>::type ........ Update documentation and remove unused code. ........ [SVN r81716]
This commit is contained in:
@@ -9,6 +9,17 @@
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/smart_ptr/make_shared_array.hpp>
|
||||
|
||||
class type {
|
||||
public:
|
||||
type(int x, int y)
|
||||
: x(x), y(y) {
|
||||
}
|
||||
const int x;
|
||||
const int y;
|
||||
private:
|
||||
type& operator=(const type&);
|
||||
};
|
||||
|
||||
int main() {
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
{
|
||||
@@ -69,6 +80,22 @@ int main() {
|
||||
BOOST_TEST(a1[1][1][0] == 2);
|
||||
BOOST_TEST(a1[1][1][1] == 3);
|
||||
}
|
||||
#if defined(BOOST_HAS_RVALUE_REFS)
|
||||
{
|
||||
boost::shared_ptr<type[]> a1 = boost::make_shared<type[]>(4, {1, 2});
|
||||
BOOST_TEST(a1[0].x == 1);
|
||||
BOOST_TEST(a1[1].y == 2);
|
||||
BOOST_TEST(a1[2].x == 1);
|
||||
BOOST_TEST(a1[3].y == 2);
|
||||
}
|
||||
{
|
||||
boost::shared_ptr<type[4]> a1 = boost::make_shared<type[4]>({1, 2});
|
||||
BOOST_TEST(a1[0].x == 1);
|
||||
BOOST_TEST(a1[1].y == 2);
|
||||
BOOST_TEST(a1[2].x == 1);
|
||||
BOOST_TEST(a1[3].y == 2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user