Skip to content

Instantly share code, notes, and snippets.

@asarium
Created May 4, 2015 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asarium/345f8f1b84d2e5b93a2a to your computer and use it in GitHub Desktop.
Save asarium/345f8f1b84d2e5b93a2a to your computer and use it in GitHub Desktop.
diff --git a/code/globalincs/vmallocator.h b/code/globalincs/vmallocator.h
index 0079d04..2bd9254 100644
--- a/code/globalincs/vmallocator.h
+++ b/code/globalincs/vmallocator.h
@@ -54,9 +54,15 @@ public:
typedef const value_type& const_reference;
/* portej05 does not like this particular function. */
- void construct( pointer p, const T& value )
+ void construct(pointer p, const T& arg)
{
- ::new (p) T(value);
+ ::new ((void*)p) T(arg);
+ }
+
+ template<typename U, typename... Args>
+ void construct(U* p, Args&&... args)
+ {
+ ::new ((void*)p) U(std::forward<Args>(args)...);
}
void destroy( pointer p )
@@ -64,6 +70,12 @@ public:
DESTROY( T, p );
}
+ template<typename U>
+ void destroy( U* p )
+ {
+ DESTROY( U, p );
+ }
+
pointer allocate( size_type n )
{
if ( n == 0 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment