Browse Source

Simplified internal ResourceManager::free() implementation.

No need to explicitly create all the pointers and then juggle with
`std::common_type<>` and whatnot.
pull/277/head
Vladimír Vondruš 13 years ago
parent
commit
b7bcf0dc59
  1. 8
      src/ResourceManager.h

8
src/ResourceManager.h

@ -348,7 +348,7 @@ template<class... Types> class ResourceManager: private Implementation::Resource
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
*/ */
ResourceManager<Types...>* free() { ResourceManager<Types...>* free() {
freeInternal(std::common_type<Types>()...); freeInternal<Types...>();
return this; return this;
} }
@ -374,11 +374,11 @@ template<class... Types> class ResourceManager: private Implementation::Resource
} }
private: private:
template<class FirstType, class ...NextTypes> void freeInternal(std::common_type<FirstType>, std::common_type<NextTypes>... t) { template<class FirstType, class ...NextTypes> void freeInternal() {
free<FirstType>(); free<FirstType>();
freeInternal(t...); freeInternal<NextTypes...>();
} }
void freeInternal() const {} template<class...> void freeInternal() const {}
static ResourceManager<Types...>*& internalInstance(); static ResourceManager<Types...>*& internalInstance();
}; };

Loading…
Cancel
Save