min_size.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #include "min_size.h"
  2. template <typename T>
  3. IGL_INLINE int igl::min_size(const std::vector<T> & V)
  4. {
  5. int min_size = -1;
  6. for(
  7. typename std::vector<T>::const_iterator iter = V.begin();
  8. iter != V.end();
  9. iter++)
  10. {
  11. int size = (int)iter->size();
  12. // have to handle base case
  13. if(min_size == -1)
  14. {
  15. min_size = size;
  16. }else{
  17. min_size = (min_size < size ? min_size : size);
  18. }
  19. }
  20. return min_size;
  21. }
  22. #ifndef IGL_HEADER_ONLY
  23. // Explicit template specialization
  24. // generated by autoexplicit.sh
  25. template int igl::min_size<std::vector<int, std::allocator<int> > >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&);
  26. // generated by autoexplicit.sh
  27. template int igl::min_size<std::vector<double, std::allocator<double> > >(std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > const&);
  28. template int igl::min_size<std::vector<bool, std::allocator<bool> > >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&);
  29. #endif