Add reserve_vector to libslic3r.h to be globally usable.
This commit is contained in:
parent
7158690ddd
commit
add3894e8c
@ -114,15 +114,6 @@ template<class T> struct remove_cvref
|
||||
|
||||
template<class T> using remove_cvref_t = typename remove_cvref<T>::type;
|
||||
|
||||
template<class T, class I, class... Args> // Arbitrary allocator can be used
|
||||
inline IntegerOnly<I, std::vector<T, Args...>> reserve_vector(I capacity)
|
||||
{
|
||||
std::vector<T, Args...> ret;
|
||||
if (capacity > I(0)) ret.reserve(size_t(capacity));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// Exactly like Matlab https://www.mathworks.com/help/matlab/ref/linspace.html
|
||||
template<class T, class I, class = IntegerOnly<I>>
|
||||
inline std::vector<T> linspace_vector(const ArithmeticOnly<T> &start,
|
||||
|
@ -266,6 +266,15 @@ using IteratorOnly = std::enable_if_t<
|
||||
!std::is_same_v<typename std::iterator_traits<T>::value_type, void>, O
|
||||
>;
|
||||
|
||||
template<class T, class I, class... Args> // Arbitrary allocator can be used
|
||||
IntegerOnly<I, std::vector<T, Args...>> reserve_vector(I capacity)
|
||||
{
|
||||
std::vector<T, Args...> ret;
|
||||
if (capacity > I(0)) ret.reserve(size_t(capacity));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user