Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / utility / defaultinitializationallocator.h
index a9e8ac2639905a794648843d83f87141857e9752..a98dc4491d5488b729f736cb57f044b7877769e0 100644 (file)
@@ -54,34 +54,35 @@ namespace gmx
  *
  * This can be used to avoid initialization e.g. on resize() in std::vector.
  */
-template <typename T, typename A = std::allocator<T> >
+template<typename T, typename A = std::allocator<T>>
 class DefaultInitializationAllocator : public A
 {
     typedef std::allocator_traits<A> a_t;
-    public:
-        template <typename U> struct rebind {
-            using other =
-                    DefaultInitializationAllocator < U, typename a_t::template rebind_alloc < U>>;
-        };
 
-        using A::A;
+public:
+    template<typename U>
+    struct rebind
+    {
+        using other = DefaultInitializationAllocator<U, typename a_t::template rebind_alloc<U>>;
+    };
 
-        /*! \brief Constructs an object and default initializes */
-        template <typename U>
-        void construct(U* ptr)
-        noexcept(std::is_nothrow_default_constructible<U>::value) {
-            ::new(static_cast<void*>(ptr))U;
-        }
+    using A::A;
 
-        /*! \brief Constructs an object and value initializes */
-        template <typename U, typename ... Args>
-        void construct(U* ptr, Args && ... args)
-        {
-            a_t::construct(static_cast<A &>(*this),
-                           ptr, std::forward<Args>(args) ...);
-        }
+    /*! \brief Constructs an object and default initializes */
+    template<typename U>
+    void construct(U* ptr) noexcept(std::is_nothrow_default_constructible<U>::value)
+    {
+        ::new (static_cast<void*>(ptr)) U;
+    }
+
+    /*! \brief Constructs an object and value initializes */
+    template<typename U, typename... Args>
+    void construct(U* ptr, Args&&... args)
+    {
+        a_t::construct(static_cast<A&>(*this), ptr, std::forward<Args>(args)...);
+    }
 };
 
-}      // namespace gmx
+} // namespace gmx
 
 #endif // GMX_UTILITY_DEFAULTINITIALIZATIONALLOCATOR_H