vector.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // ======================================================================== //
  2. // Copyright 2009-2017 Intel Corporation //
  3. // //
  4. // Licensed under the Apache License, Version 2.0 (the "License"); //
  5. // you may not use this file except in compliance with the License. //
  6. // You may obtain a copy of the License at //
  7. // //
  8. // http://www.apache.org/licenses/LICENSE-2.0 //
  9. // //
  10. // Unless required by applicable law or agreed to in writing, software //
  11. // distributed under the License is distributed on an "AS IS" BASIS, //
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
  13. // See the License for the specific language governing permissions and //
  14. // limitations under the License. //
  15. // ======================================================================== //
  16. #pragma once
  17. #include "alloc.h"
  18. /*! instantiate vector using default allocator */
  19. #define vector_t vector
  20. #define allocator_t std::allocator<T>
  21. #include "vector_t.h"
  22. #undef vector_t
  23. #undef allocator_t
  24. /*! instantiate vector using aligned malloc */
  25. #define vector_t avector
  26. #define allocator_t aligned_allocator<T,std::alignment_of<T>::value>
  27. #include "vector_t.h"
  28. #undef vector_t
  29. #undef allocator_t
  30. /*! instantiate vector using os_malloc */
  31. #define vector_t ovector
  32. #define allocator_t os_allocator<T>
  33. #include "vector_t.h"
  34. #undef vector_t
  35. #undef allocator_t
  36. namespace embree
  37. {
  38. /*! vector class that performs aligned allocations */
  39. //template<typename T> // FIXME: unfortunately not supported in VS2012
  40. // using avector = vector_t<T,aligned_allocator<T,std::alignment_of<T>::value> >;
  41. /*! vector class that performs OS allocations */
  42. //template<typename T> // FIXME: unfortunately not supported in VS2012
  43. // using ovector = vector_t<T,os_allocator<T> >;
  44. }