-inline char *wxStrstr(char *haystack, const char *needle)
- { return (char *)wxStrstr((const char *)haystack, needle); }
-inline wchar_t *wxStrstr(wchar_t *haystack, const wchar_t *needle)
- { return (wchar_t *)wxStrstr((const wchar_t *)haystack, needle); }
-inline char *wxStrstr(char *haystack, const wxString& needle)
- { return (char *)wxStrstr((const char *)haystack, needle); }
-inline wchar_t *wxStrstr(wchar_t *haystack, const wxString& needle)
- { return (wchar_t *)wxStrstr((const wchar_t *)haystack, needle); }
-
-inline char * wxStrchr(char *s, char c)
- { return (char *)wxStrchr((const char *)s, c); }
-inline char * wxStrrchr(char *s, char c)
- { return (char *)wxStrrchr((const char *)s, c); }
-inline wchar_t * wxStrchr(wchar_t *s, wchar_t c)
+template <typename T>
+inline char *wxStrstr(char *haystack, T needle)
+ { return const_cast<char*>(wxStrstr(const_cast<const char*>(haystack), needle)); }
+template <typename T>
+inline wchar_t *wxStrstr(wchar_t *haystack, T needle)
+ { return const_cast<wchar_t*>(wxStrstr(const_cast<const wchar_t*>(haystack), needle)); }
+
+template <typename T>
+inline char * wxStrchr(char *s, T c)
+ { return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); }
+template <typename T>
+inline wchar_t * wxStrchr(wchar_t *s, T c)