diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-19 20:14:56 +0000 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-19 20:14:56 +0000 | 
| commit | 3088f0169c957bc2fe7af71591c6c8e1b0490552 (patch) | |
| tree | b2f40a7cef29a330dd259bbceb3d139b06fe9ca6 | |
| parent | Use constexpr TypeName to find interface property names (diff) | |
| download | icespider-3088f0169c957bc2fe7af71591c6c8e1b0490552.tar.bz2 icespider-3088f0169c957bc2fe7af71591c6c8e1b0490552.tar.xz icespider-3088f0169c957bc2fe7af71591c6c8e1b0490552.zip  | |
Forbid templates in type_names helper
They return different names WRT default template arguments on different compilers.
| -rw-r--r-- | icespider/core/util.h | 10 | 
1 files changed, 6 insertions, 4 deletions
diff --git a/icespider/core/util.h b/icespider/core/util.h index ca1350b..406faba 100644 --- a/icespider/core/util.h +++ b/icespider/core/util.h @@ -49,10 +49,12 @@ template<typename T> struct type_names {  	static constexpr auto  	name()  	{ -		const std::string_view with_T {"T = "}; -		const auto start {pf().find(with_T) + with_T.length()}; -		const auto end {pf().find(']', start)}; -		return pf().substr(start, end - start); +		constexpr std::string_view with_T {"T = "}; +		constexpr auto start {pf().find(with_T) + with_T.length()}; +		constexpr auto end {pf().find(']', start)}; +		constexpr auto name {pf().substr(start, end - start)}; +		static_assert(name.find('<') == std::string_view::npos, "Templates not supported"); +		return name;  	}  	static constexpr auto  | 
