Switch select_file_subfunction_t to anonymous template typedef

This commit is contained in:
Kp 2016-01-29 04:05:47 +00:00
parent ff67afd440
commit d8292300ab

View file

@ -142,21 +142,21 @@ static void do_multi_player_menu();
static void do_sandbox_menu();
#endif
namespace {
template <typename T>
class select_file_subfunction_t
{
public:
typedef int (*type)(T *, const char *);
};
using select_file_subfunction = int (*)(T *, const char *);
}
__attribute_nonnull()
static int select_file_recursive(const char *title, const char *orig_path, const partial_range_t<const file_extension_t *> &ext_list, int select_dir, select_file_subfunction_t<void>::type when_selected, void *userdata);
static int select_file_recursive(const char *title, const char *orig_path, const partial_range_t<const file_extension_t *> &ext_list, int select_dir, select_file_subfunction<void> when_selected, void *userdata);
template <typename T, std::size_t count>
__attribute_nonnull()
static int select_file_recursive(const char *title, const char *orig_path, const array<file_extension_t, count> &ext_list, int select_dir, typename select_file_subfunction_t<T>::type when_selected, T *userdata)
static int select_file_recursive(const char *title, const char *orig_path, const array<file_extension_t, count> &ext_list, int select_dir, select_file_subfunction<T> when_selected, T *userdata)
{
return select_file_recursive(title, orig_path, ext_list, select_dir, reinterpret_cast<select_file_subfunction_t<void>::type>(when_selected), reinterpret_cast<void *>(userdata));
return select_file_recursive(title, orig_path, ext_list, select_dir, reinterpret_cast<select_file_subfunction<void>>(when_selected), reinterpret_cast<void *>(userdata));
}
// Hide all menus
@ -1762,7 +1762,7 @@ static int select_file_handler(listbox *menu,const d_event &event, browser *b)
return 0;
}
static int select_file_recursive(const char *title, const char *orig_path, const partial_range_t<const file_extension_t *> &ext_range, int select_dir, select_file_subfunction_t<void>::type when_selected, void *userdata)
static int select_file_recursive(const char *title, const char *orig_path, const partial_range_t<const file_extension_t *> &ext_range, int select_dir, select_file_subfunction<void> when_selected, void *userdata)
{
const char *sep = PHYSFS_getDirSeparator();
char *p;