Add fourth form of make_unique for objects

To support initialization syntax that Args&&... cannot forward perfectly.
This commit is contained in:
Glen Fernandes
2014-01-29 16:33:32 -08:00
parent f91e7e9ce7
commit 72e5fb6fd7
7 changed files with 95 additions and 37 deletions

View File

@@ -40,17 +40,7 @@ int main() {
std::unique_ptr<int[][2]> a1 = boost::make_unique_noinit<int[][2]>(2);
BOOST_TEST(a1.get() != 0);
}
{
std::unique_ptr<const int[]> a1 = boost::make_unique_noinit<const int[]>(3);
BOOST_TEST(a1.get() != 0);
}
{
std::unique_ptr<const int[][2]> a1 = boost::make_unique_noinit<const int[][2]>(2);
BOOST_TEST(a1.get() != 0);
}
BOOST_TEST(type::instances == 0);
{
std::unique_ptr<type[]> a1 = boost::make_unique_noinit<type[]>(3);
@@ -72,7 +62,6 @@ int main() {
BOOST_TEST(type::instances == 0);
{
std::unique_ptr<const type[]> a1 = boost::make_unique_noinit<const type[]>(3);
const type* a2 = a1.get();
BOOST_TEST(a1.get() != 0);
BOOST_TEST(type::instances == 3);
a1.reset();