9 | | r1001: landauf: ok, be aware, here comes a big one. people with weak nerves should probably better look away or take some serious drugs. |
10 | | this update includes partial and explicit class template specialization, partial and explicit specialized template function overloading, template meta programming and a simple typecast. |
11 | | yeah right, a typecast. but let me explain the whole story from the beginning. |
| 9 | r1001: landauf: ok, be aware, here comes a big one. people with weak nerves should probably better look away or take some serious drugs.[[br]] |
| 10 | this update includes partial and explicit class template specialization, partial and explicit specialized template function overloading, template meta programming and a simple typecast.[[br]] |
| 11 | yeah right, a typecast. but let me explain the whole story from the beginning.[[br]] |
13 | | it all started with a simple problem: i had a double in a MultiType? and wanted a float, but i always got 0. what was the problem? the conversion 'MultiType? to anyting' was handled by the Converter class in util/Convert.h and the Converter was specialized for strings, multitypes, vectors and so on, but not for int, float, bool, ... |
14 | | so i've first wanted to implement a typecast as default, but this was a bad idea because it doesn't work for almost every generic type. |
15 | | implementing an explicit specialization for every possible pair of primitives (did you ever happened to use an unsigned short? or a long double? no? ignorants :D) would have been a simple but ugly solution. |
16 | | but there were other problems: if there's a rule to convert a string into anything and another rule to convert anything into an int - what happens if you want to convert a string into an int? compiler error! ...ambiguous partial template specialization. |
17 | | so i've spent days and nights to find a solution. this is my 5th try or so and i'm still really unsure if it works, but it's the first version i want to commit to have at least a backup. |
| 13 | it all started with a simple problem: i had a double in a MultiType? and wanted a float, but i always got 0. what was the problem? the conversion 'MultiType? to anyting' was handled by the Converter class in util/Convert.h and the Converter was specialized for strings, multitypes, vectors and so on, but not for int, float, bool, ...[[br]] |
| 14 | so i've first wanted to implement a typecast as default, but this was a bad idea because it doesn't work for almost every generic type.[[br]] |
| 15 | implementing an explicit specialization for every possible pair of primitives (did you ever happened to use an unsigned short? or a long double? no? ignorants :D) would have been a simple but ugly solution.[[br]] |
| 16 | but there were other problems: if there's a rule to convert a string into anything and another rule to convert anything into an int - what happens if you want to convert a string into an int? compiler error! ...ambiguous partial template specialization.[[br]] |
| 17 | so i've spent days and nights to find a solution. this is my 5th try or so and i'm still really unsure if it works, but it's the first version i want to commit to have at least a backup.[[br]] |