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 6735097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:58:04+00:00 2026-05-26T10:58:04+00:00

This code compiles fine with Visual C++ 11 Developer Preview but won’t compile with

  • 0

This code compiles fine with Visual C++ 11 Developer Preview but won’t compile with gcc 4.6.1.

How to make it “compilable” for the latter?

#ifndef PROMOTE_H_INCLUDED
#define PROMOTE_H_INCLUDED
#include <boost\mpl\vector.hpp>
#include <boost\mpl\find.hpp>
#include <boost\mpl\next.hpp>
#include <boost\mpl\deref.hpp>

namespace mpl =  boost::mpl;
template<class Integral>
struct Promote
{
    typedef  mpl::vector<char,short,int,long,long long> types;
    typedef typename  mpl::find<types,Integral>::type this_type;
    typedef typename  mpl::next<this_type>::type next_type;
    typedef typename  mpl::deref<next_type>::type type;
};
#endif // PROMOTE_H_INCLUDED  

and then in main:

cout << typeid( Promote<int>::type).name() ;
  • 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-05-26T10:58:05+00:00Added an answer on May 26, 2026 at 10:58 am

    Change your include directives:

    #include <boost/mpl/vector.hpp>
    

    This will work both on Windows and Unix-type systems.

    No other syntax problems detected (but since this is just a template, I have no idea if there are problems when you actually use it).

    Edit: with what you add in the main, it compiles with GCC 4.6.1.
    Don’t forget to #include <typeinfo>.

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

Sidebar

Related Questions

This code compiles fine: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, FlexibleContexts, EmptyDataDecls, ScopedTypeVariables, TypeOperators,
I'm having a hard time using std::string::iterators in C++. This code compiles fine (still
Please check this code out it compiles and runs absolutely fine.. The question is
I have non-template class with a templatized constructor. This code compiles for me. But
This piece of code compiles and runs as expected on GCC 3.x and 4.x:
I have the following code which compiles and runs fine under Visual Studio 2008
I had the following code line which compiles just fine under g++ and Visual
Here's yet another VC9 vs. GCC 4.2 compile error problem. The following code compiles
The following code compiles fine on majority of compilers (include Microsoft Visual Studio's -
i am using this code to check if my glsl shader compiled fine. glGetObjectParameterivARB(obj,

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.