Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7730689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:17:18+00:00 2026-06-01T06:17:18+00:00

This is the code snippet: #include <boost/utility.hpp> #include <boost/type_traits.hpp> #include <boost/type_traits/is_base_of.hpp> #include <boost/typeof/typeof.hpp> enum

  • 0

This is the code snippet:

#include <boost/utility.hpp>
#include <boost/type_traits.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/typeof/typeof.hpp>

enum ScriptVarType_t { SVT_BOOL, SVT_STRING, SVT_CUSTOM, SVT_CustomWeakRefToStatic };

struct ScriptVar_t {};
struct CustomVar {
    struct Ref {};
    struct WeakRef {};
};

template<typename T> struct GetType;

template<typename T> struct _GetTypeSimple {
    typedef T type;
    static type defaultValue() { return T(); }
    static const type& constRef(const type& v) { return v; }
};

template<> struct GetType<bool> : _GetTypeSimple<bool> { static const ScriptVarType_t value = SVT_BOOL; };
template<> struct GetType<std::string> : _GetTypeSimple<std::string> { static const ScriptVarType_t value = SVT_STRING; };
template<> struct GetType<CustomVar::Ref> {
    typedef CustomVar::Ref type;
    static const ScriptVarType_t value = SVT_CUSTOM;
    static type defaultValue() { return type(); }
    static const type& constRef(const type& v) { return v; }
};


template<typename T>
struct CustomVarWeakRefType {
    typedef CustomVar::WeakRef type;
    static const ScriptVarType_t value = SVT_CustomWeakRefToStatic;
    static CustomVar::Ref defaultValue() { return T().getRefCopy(); }
    static CustomVar::WeakRef constRef(const T& v) { return v.thisRef.obj; }
};

struct StringType : GetType<std::string> {};

template<typename T>
struct _SelectType {
    static CustomVarWeakRefType<T>* selectType(const CustomVar&) { return NULL; }

    static StringType* selectType(const char*) { return NULL; }
    static StringType* selectType(char[]) { return NULL; }

    typedef typename BOOST_TYPEOF(*selectType(*(T*)NULL)) type;
};

template<typename T> struct GetType : _SelectType<T>::type {};

template<typename T>
T _CastScriptVarConst(const ScriptVar_t& s, T*, typename boost::enable_if_c<(GetType<T>::value < SVT_CUSTOM), T>::type*) {
    return (T) s;
}

template<typename T>
T _CastScriptVarConst(const ScriptVar_t& s, T*, typename boost::enable_if_c<boost::is_base_of<CustomVar,T>::value, T>::type*) {
    return *s.as<T>();
}

Some of the errors:

3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(416): error C2059: Syntaxfehler: ')'
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(416): error C2143: Syntaxfehler: Es fehlt ',' vor ')'
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(416): error C2947: ">" wird erwartet, um template-argument-list abzubrechen. ">" wurde gefunden.
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(416): warning C4346: 'GetType<T>::value<T>::type': Abhängiger Name ist kein Typ
3>          Präfix mit 'typename' zum Angeben eines Typs
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(416): error C2059: Syntaxfehler: ')'
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(421): error C2059: Syntaxfehler: ','
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(421): warning C4346: 'boost::is_base_of<CustomVar,T>::value': Abhängiger Name ist kein Typ
3>          Präfix mit 'typename' zum Angeben eines Typs
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(421): error C2143: Syntaxfehler: Es fehlt ',' vor ')'
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(421): error C2143: Syntaxfehler: Es fehlt ';' vor '{'
3>c:\users\albert zeyer\programmierung\openlierox\include\CScriptableVars.h(423): error C2143: Syntaxfehler: Es fehlt ';' vor '}'

(Btw., any way to get these messages in English? I’m new to MSVC. E.g., it says: “>” is expected to cancel template-argument-list, but “>” was found.)

The error messages are mostly totaly stupid or wrong.

Why is that? I don’t even really see at what part MSVC is struggling.

How can I work around it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:17:19+00:00Added an answer on June 1, 2026 at 6:17 am

    Ok, found the problem. The less-comparison in enable_if_c<(GetType<T>::value < SVT_CUSTOM), T> confuses the compiler because it cannot really know that value is an integer.

    I changed it to GetType<T>::value <= SVT_CUSTOM-1 and it all works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compile the following snippet of code: #include <boost/filesystem/path.hpp> //Other includes snipped
How can I include this code snippet within each activity without explicitly copy and
i have this code snippet #include <iostream> using namespace std; class Polygon { public:
I'm struggling a bit to understand why this code snippet does not compile. #include
It looks like this snippet of code doesn't work unless I include the first
Start with the code: #include <iostream> #include <string> #include <map> #include <boost/asio.hpp> typedef std::map<boost::asio::ip::address,
The Google Analytics setup instructions state: This tracking code snippet should be included in
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
Take this code snippet for example: window.location.href = 'mysite.htm#images'; Already being on the site
VS 2008 I have this code snippet I found on a VB website. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.