Add skstd::remove_pointer_t and use it.

This replaces an existing incomplete implementation. This also makes
it easier to update the current use in the future when switching to
<type_traits>.

Review URL: https://codereview.chromium.org/1555153002
This commit is contained in:
bungeman 2016-01-06 08:30:59 -08:00 committed by Commit bot
parent 1e1e5094e0
commit 54e6308219
2 changed files with 3 additions and 4 deletions

View File

@ -31,6 +31,7 @@ template <bool B, typename T = void> using enable_if_t = typename std::enable_if
template <typename T> using remove_const_t = typename std::remove_const<T>::type;
template <typename T> using remove_volatile_t = typename std::remove_volatile<T>::type;
template <typename T> using remove_cv_t = typename std::remove_cv<T>::type;
template <typename T> using remove_pointer_t = typename std::remove_pointer<T>::type;
template <typename T> using remove_reference_t = typename std::remove_reference<T>::type;
template <typename T> using remove_extent_t = typename std::remove_extent<T>::type;

View File

@ -12,6 +12,7 @@
#include "SkTDArray.h"
#include "SkTSearch.h"
#include "SkTemplates.h"
#include "SkTLogic.h"
#include <dirent.h>
#include <expat.h>
@ -579,9 +580,6 @@ static const XML_Memory_Handling_Suite sk_XML_alloc = {
sk_free
};
template<typename T> struct remove_ptr {typedef T type;};
template<typename T> struct remove_ptr<T*> {typedef T type;};
/**
* This function parses the given filename and stores the results in the given
* families array. Returns the version of the file, negative if the file does not exist.
@ -598,7 +596,7 @@ static int parse_config_file(const char* filename, SkTDArray<FontFamily*>& famil
return -1;
}
SkAutoTCallVProc<remove_ptr<XML_Parser>::type, XML_ParserFree> parser(
SkAutoTCallVProc<skstd::remove_pointer_t<XML_Parser>, XML_ParserFree> parser(
XML_ParserCreate_MM(nullptr, &sk_XML_alloc, nullptr));
if (!parser) {
SkDebugf(SK_FONTMGR_ANDROID_PARSER_PREFIX "could not create XML parser\n");