mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-07-27 11:54:41 +03:00
Add reserve_vector to libslic3r.h to be globally usable.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user