construct.h 449 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef __DAHUA_INFRA_CONSTRUCT_H__
  2. #define __DAHUA_INFRA_CONSTRUCT_H__
  3. namespace Dahua {
  4. namespace Infra {
  5. namespace Datail {
  6. template <typename T>
  7. void construct(T* addr, T const& value)
  8. {
  9. new (addr) T(value);
  10. }
  11. template <typename T>
  12. void destruct(T& value)
  13. {
  14. value.~T();
  15. }
  16. template <typename T>
  17. void destruct(T* value)
  18. {
  19. value->~T();
  20. }
  21. } // end of Detail
  22. } // end of Infra
  23. } // end of Dahua
  24. #endif // end of __DAHUA_INFRA_CONSTRUCT_H__