aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/common.h20
-rw-r--r--c/pl.h16
2 files changed, 18 insertions, 18 deletions
diff --git a/c/common.h b/c/common.h
index acb8f26..efaa800 100644
--- a/c/common.h
+++ b/c/common.h
@@ -29,12 +29,12 @@ struct Library
{
Library(const TCHAR* tszLibrary);
~Library();
- template <typename T> T* GetProcAddress(const char* szProc);
+ template <class T> T* GetProcAddress(const char* szProc);
private:
HMODULE m_hModule;
};
-template <typename T>
+template <class T>
T* Library::GetProcAddress(const char* const szProc)
{
return (T*)(void*)::GetProcAddress(m_hModule, szProc);
@@ -43,8 +43,8 @@ T* Library::GetProcAddress(const char* const szProc)
/* Create and return an object of type C. If construction fails,
* return nothing. The returned value must be checked before being
* used, as dereferencing is undefined if the value is empty. */
-template <class C, typename ...T>
-std::optional<C> maybe_make(T ...args)
+template <class C, class... T>
+std::optional<C> maybe_make(T... args)
{
try {
return C(args...);
@@ -53,18 +53,18 @@ std::optional<C> maybe_make(T ...args)
}
}
-/* Call Windows API function and throw error if NULL is returned. */
-template <auto f, typename ...T>
-inline auto throw_nil(T ...args)
+/* Call Windows API function, throwing error on NULL. */
+template <auto f, class... T>
+inline auto throw_nil(T... args)
{
auto r = f(args...);
if (!r) throw Win32Error(GetLastError());
return r;
}
-/* Call Windows API function and show a warning if NULL is returned. */
-template <auto f, typename ...T>
-inline auto warn_nil(T ...args)
+/* Call Windows API function, showing a warning on NULL. */
+template <auto f, class... T>
+inline auto warn_nil(T... args)
{
decltype(f(args...)) r;
try {
diff --git a/c/pl.h b/c/pl.h
index 00285e0..70839a9 100644
--- a/c/pl.h
+++ b/c/pl.h
@@ -67,21 +67,21 @@ inline int PlGet(const term_t t, char** const x) { return PL_get_atom_chars(t, x
inline int PlGet(const term_t t, wchar_t** const x) { size_t len; return PL_get_wchars(t, &len, x, CVT_ATOM); }
/* Helper templates for Plx, Pl. */
-template <typename T>
+template <class T>
int PlPutv(const term_t t, T arg) { return PlPut(t, arg); }
-template <typename T, typename ...R>
+template <class T, class... R>
int PlPutv(const term_t t, T arg, R... rest) { return PlPut(t, arg)? PlPutv(t+1, rest...): 0; }
-template <typename T>
+template <class T>
int PlGetv(const term_t t, T arg) { return PlGet(t, arg); }
-template <typename T, typename ...R>
+template <class T, class... R>
int PlGetv(const term_t t, T arg, R... rest) { return PlGet(t, arg)? PlGetv(t+1, rest...): 0; }
-template <typename T>
+template <class T>
int Countv(const int i, T) { return i+1; }
-template <typename T, typename ...R>
+template <class T, class... R>
int Countv(const int i, T, R... rest) { return Countv(i+1, rest...); }
/* Call Prolog predicate, propagating Prolog exceptions. */
-template <typename ...T>
+template <class... T>
int Plx(const char* const szMod, const char* const szPred, T... args)
{
Frame f;
@@ -95,7 +95,7 @@ int Plx(const char* const szMod, const char* const szPred, T... args)
}
/* Call Prolog predicate, ignoring Prolog exceptions. */
-template <typename ...T>
+template <class... T>
int Pl(const char* const szMod, const char* const szPred, T... args)
{
try {