Skip to content

Commit

Permalink
Remove qgis::make_unique
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 25, 2021
1 parent af10d8c commit 6869826
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/core/qgis.h
Expand Up @@ -402,42 +402,6 @@ namespace qgis
template <typename T>
void as_const( const T && ) = delete;

// make_unique - from https://stackoverflow.com/a/17902439/1861260

template<class T> struct _Unique_if
{
typedef std::unique_ptr<T> _Single_object;
};

template<class T> struct _Unique_if<T[]>
{
typedef std::unique_ptr<T[]> _Unknown_bound;
};

template<class T, size_t N> struct _Unique_if<T[N]>
{
typedef void _Known_bound;
};

template<class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique( Args &&... args )
{
return std::unique_ptr<T>( new T( std::forward<Args>( args )... ) );
}

template<class T>
typename _Unique_if<T>::_Unknown_bound
make_unique( size_t n )
{
typedef typename std::remove_extent<T>::type U;
return std::unique_ptr<T>( new U[n]() );
}

template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique( Args &&... ) = delete;

/**
* Used for new-style Qt connects to overloaded signals, avoiding the usual horrible connect syntax required
* in these circumstances.
Expand Down

0 comments on commit 6869826

Please sign in to comment.