|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71613 - sandbox/block_ptr/libs/smart_ptr/example
From: phil_at_[hidden]
Date: 2011-04-29 17:58:07
Author: pbouchard
Date: 2011-04-29 17:58:06 EDT (Fri, 29 Apr 2011)
New Revision: 71613
URL: http://svn.boost.org/trac/boost/changeset/71613
Log:
* Replaced new block to make_block
Text files modified:
sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test1.cpp | 22 +++++++++++-----------
sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test2.cpp | 20 ++++++++------------
sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test3.cpp | 18 ++++++++----------
3 files changed, 27 insertions(+), 33 deletions(-)
Modified: sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test1.cpp
==============================================================================
--- sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test1.cpp (original)
+++ sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test1.cpp 2011-04-29 17:58:06 EDT (Fri, 29 Apr 2011)
@@ -36,16 +36,16 @@
{
cout << "Cyclicism:" << endl;
{
- block_ptr<A> p = new block<A>(7);
- block_ptr<A> q = new block<A>(8);
- block_ptr<A> r = new block<A>(9);
+ block_ptr<A> p = make_block<A>(7);
+ block_ptr<A> q = make_block<A>(8);
+ block_ptr<A> r = make_block<A>(9);
- block_ptr<void> t = new block<A>(10);
- block_ptr<int const volatile> v = new block<int const volatile>(11);
+ block_ptr<void> t = make_block<A>(10);
+ block_ptr<int const volatile> v = make_block<int const volatile>(11);
p->p = p;
q = r;
- v = new block<int const volatile>(12);
+ v = make_block<int const volatile>(12);
cout << "p->i = " << p->i << endl;
cout << "q->i = " << q->i << endl;
@@ -58,8 +58,8 @@
#if ! defined(_MSC_VER)
cout << "Array access:" << endl;
{
- block_ptr<A[5]> s = new block<A[5]>();
- block_ptr<char[9]> u = new block<char[9]>();
+ block_ptr<A[5]> s = make_block<A[5]>();
+ block_ptr<char[9]> u = make_block<char[9]>();
u[4] = 'Z';
@@ -70,9 +70,9 @@
cout << "Order of destruction:" << endl;
{
- block_ptr<A> v = new block<A>(0);
- v->p = new block<A>(1);
- v->p->p = new block<A>(2);
+ block_ptr<A> v = make_block<A>(0);
+ v->p = make_block<A>(1);
+ v->p->p = make_block<A>(2);
v->p->p->p = v;
}
cout << endl;
Modified: sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test2.cpp
==============================================================================
--- sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test2.cpp (original)
+++ sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test2.cpp 2011-04-29 17:58:06 EDT (Fri, 29 Apr 2011)
@@ -20,11 +20,7 @@
static int count;
-using boost::block_ptr;
-using boost::block;
-using boost::block_allocator;
-using boost::operator ==;
-using boost::operator !=;
+using namespace boost;
struct node {
node() {
@@ -46,9 +42,9 @@
}
void insert() {
if(front.get() == 0) {
- back = new block<node>();
+ back = make_block<node>();
} else {
- back->next = new block<node>();
+ back->next = make_block<node>();
back->next->prior = back;
back = back->next;
}
@@ -72,7 +68,7 @@
struct create_type {
template<class T>
void operator()(T) const {
- new block<boost::array<char, T::value> >();
+ make_block<boost::array<char, T::value> >();
}
};
@@ -91,27 +87,27 @@
count = 0;
{
- block_ptr<vector> v = new block<vector>();
+ block_ptr<vector> v = make_block<vector>();
v->elements.push_back(v);
}
std::cout << count << std::endl;
count = 0;
{
- block_ptr<vector> v = new block<vector>();
+ block_ptr<vector> v = make_block<vector>();
v->elements.push_back(v);
}
std::cout << count << std::endl;
{
vector v;
- v.elements.push_back(new block<vector>());
+ v.elements.push_back(make_block<vector>());
}
std::cout << count << std::endl;
count = 0;
{
- block_ptr<int> test = new block<int>(5);
+ block_ptr<int> test = make_block<int>(5);
test = test;
std::cout << "test = " << * test << std::endl;
Modified: sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test3.cpp
==============================================================================
--- sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test3.cpp (original)
+++ sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test3.cpp 2011-04-29 17:58:06 EDT (Fri, 29 Apr 2011)
@@ -28,9 +28,7 @@
static int count;
-using boost::block_ptr;
-using boost::block;
-using boost::block_allocator;
+using namespace boost;
struct node {
node() {
@@ -55,9 +53,9 @@
}
void insert() {
if(front.get() == 0) {
- front = back = new block<node>();
+ front = back = make_block<node>();
} else {
- back->next = new block<node>();
+ back->next = make_block<node>();
back->next->prior = back;
back = back->next;
}
@@ -77,7 +75,7 @@
struct create_type {
template<class T>
void operator()(T) const {
- new block<boost::array<char, T::value> >();
+ make_block<boost::array<char, T::value> >();
}
};
@@ -85,7 +83,7 @@
count = 0;
{
- block_ptr<vector> v = new block<vector>();
+ block_ptr<vector> v = make_block<vector>();
v->elements.push_back(v);
}
BOOST_CHECK_EQUAL(count, 0);
@@ -104,7 +102,7 @@
count = 0;
{
- block_ptr<int> test = new block<int>(5);
+ block_ptr<int> test = make_block<int>(5);
test = test;
BOOST_CHECK_NE(test.get(), static_cast<int*>(0));
@@ -117,14 +115,14 @@
count = 0;
{
- block_ptr<vector> v = new block<vector>();
+ block_ptr<vector> v = make_block<vector>();
v->elements.push_back(v);
}
BOOST_CHECK_EQUAL(count, 0);
{
vector v;
- v.elements.push_back(new block<vector>());
+ v.elements.push_back(make_block<vector>());
}
BOOST_CHECK_EQUAL(count, 0);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk