Added the append templates for std::vector
This commit is contained in:
parent
f5e4026aee
commit
90028e47e9
1 changed files with 24 additions and 0 deletions
|
@ -11,6 +11,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iterator>
|
||||||
|
#include <utility>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#define SLIC3R_FORK_NAME "Slic3r Prusa Edition"
|
#define SLIC3R_FORK_NAME "Slic3r Prusa Edition"
|
||||||
|
@ -137,6 +139,28 @@ parallelize(T start, T end, boost::function<void(T)> func,
|
||||||
parallelize(queue, func, threads_count);
|
parallelize(queue, func, threads_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void append(std::vector<T>& dest, const std::vector<T>& src)
|
||||||
|
{
|
||||||
|
if (dest.empty())
|
||||||
|
dest = src;
|
||||||
|
else
|
||||||
|
dest.insert(std::end(dest), std::cbegin(src), std::cend(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void append(std::vector<T>& dest, std::vector<T>&& src)
|
||||||
|
{
|
||||||
|
if (dest.empty())
|
||||||
|
dest = std::move(src);
|
||||||
|
else
|
||||||
|
dest.insert(std::end(dest),
|
||||||
|
std::make_move_iterator(std::begin(src)),
|
||||||
|
std::make_move_iterator(std::end(src)));
|
||||||
|
src.clear();
|
||||||
|
src.shrink_to_fit();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue