I'm making some win32 string API calls and am assuming that the strings come out as wide strings, which is valid on XP and newer. How can I assert this? Is this a runtime check or a compile-time check?
Am I doing it wrong? Here's an example:
typedef std::basic_string<TCHAR> TString;
inline TString queryRegStringValue(HKEY key, const TString& subkey, 
        const TString defaultValue = TEXT(""))
{
    std::vector<char> out_bytes(256);
    DWORD num_bytes = out_bytes.size();
    DWORD out_type;
    long retval = RegQueryValueEx(key, subkey.c_str(), 0, &out_type, 
        reinterpret_cast<BYTE*>(&out_bytes[0]), &num_bytes); //comes out as a platform string. wide on XP
    if (retval != 0)
        return defaultValue;
    if (num_bytes > 0)
    {
        assert(out_type == REG_SZ);
        BOOST_STATIC_ASSERT(sizeof(TCHAR)==2); //what if someone runs my code on an older system?
        return TString(reinterpret_cast<wchar_t*>(&out_bytes[0]), num_bytes/2); //assumes windows XP (wide string)
    }
    return TEXT("");
}