forked from boostorg/smart_ptr
Fix formatting in headers and tests
This commit is contained in:
committed by
Glen Fernandes
parent
8298952a12
commit
e13beef5df
@ -24,16 +24,13 @@ struct up_if_object {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct up_if_object<T[]> {
|
struct up_if_object<T[]> { };
|
||||||
};
|
|
||||||
|
|
||||||
template<class T, std::size_t N>
|
template<class T, std::size_t N>
|
||||||
struct up_if_object<T[N]> {
|
struct up_if_object<T[N]> { };
|
||||||
};
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct up_if_array {
|
struct up_if_array { };
|
||||||
};
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct up_if_array<T[]> {
|
struct up_if_array<T[]> {
|
||||||
@ -46,8 +43,7 @@ struct up_value {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct up_element {
|
struct up_element { };
|
||||||
};
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct up_element<T[]> {
|
struct up_element<T[]> {
|
||||||
@ -56,8 +52,7 @@ struct up_element<T[]> {
|
|||||||
} /* detail */
|
} /* detail */
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline typename detail::up_if_object<T>::type
|
inline typename detail::up_if_object<T>::type make_unique()
|
||||||
make_unique()
|
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T());
|
return std::unique_ptr<T>(new T());
|
||||||
}
|
}
|
||||||
@ -65,7 +60,7 @@ make_unique()
|
|||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
template<class T, class... Args>
|
template<class T, class... Args>
|
||||||
inline typename detail::up_if_object<T>::type
|
inline typename detail::up_if_object<T>::type
|
||||||
make_unique(Args&&... args)
|
make_unique(Args&&... args)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
@ -73,21 +68,19 @@ make_unique(Args&&... args)
|
|||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline typename detail::up_if_object<T>::type
|
inline typename detail::up_if_object<T>::type
|
||||||
make_unique(typename detail::up_value<T>::type value)
|
make_unique(typename detail::up_value<T>::type value)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T(std::move(value)));
|
return std::unique_ptr<T>(new T(std::move(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline typename detail::up_if_object<T>::type
|
inline typename detail::up_if_object<T>::type make_unique_noinit()
|
||||||
make_unique_noinit()
|
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T);
|
return std::unique_ptr<T>(new T);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline typename detail::up_if_array<T>::type
|
inline typename detail::up_if_array<T>::type make_unique(std::size_t n)
|
||||||
make_unique(std::size_t n)
|
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new
|
return std::unique_ptr<T>(new
|
||||||
typename detail::up_element<T>::type[n]());
|
typename detail::up_element<T>::type[n]());
|
||||||
@ -95,7 +88,7 @@ make_unique(std::size_t n)
|
|||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline typename detail::up_if_array<T>::type
|
inline typename detail::up_if_array<T>::type
|
||||||
make_unique_noinit(std::size_t n)
|
make_unique_noinit(std::size_t n)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new
|
return std::unique_ptr<T>(new
|
||||||
typename detail::up_element<T>::type[n]);
|
typename detail::up_element<T>::type[n]);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2014 Glen Joseph Fernandes
|
(c) 2012-2015 Glen Joseph Fernandes
|
||||||
* glenfe at live dot com
|
<glenjofe -at- gmail.com>
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License,
|
Distributed under the Boost Software
|
||||||
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
License, Version 1.0.
|
||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
http://boost.org/LICENSE_1_0.txt
|
||||||
*/
|
*/
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user