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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:12:28+00:00 2026-06-08T17:12:28+00:00

I had a problem today using the using keyword in C++11 . I decided

  • 0

I had a problem today using the using keyword in C++11. I decided to use another approach now (added as comments in the example below). You can think of X as a matrix, of Y as a mixin and the aim is to access the tranposed matrix type of X in Y. Instead of typedefing X<B,A> in X<A,B>, we take another approach that is more powerful and define a Sibling alias that takes two template parameters itself.

template <class A, class B>
struct X
{
  using Left = A;
  using Right = B;
  template <class T1, class T2>
  using Sibling = X<T1, T2>;
  // using Reversed = X<B, A>; // What I really want and use now. :-)
};

template <class A>
struct Y
{
  using Left = typename A::Left;
  using Right = typename A::Right;
  using AReverse = typename A::Sibling<Right, Left>; // Gives a compiler error
  // using AReverse2 = typename A::Reversed; // Works, of course.
};

using Z = X<int,double>::Sibling<double,int>; // Works

I tried compiling the code above with g++-4.7 -std=c++11 -c and it shows me the following error message:

t.cpp:16:9: error: expected nested-name-specifier before ‘AReverse’
t.cpp:16:9: error: using-declaration for non-member at class scope
t.cpp:16:18: error: expected ‘;’ before ‘=’ token
t.cpp:16:18: error: expected unqualified-id before ‘=’ token

I do not understand why a get an error message at all or how I could fix it. Could someone explain to me what the problem is?

Thanks alot!

  • 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-08T17:12:31+00:00Added an answer on June 8, 2026 at 5:12 pm

    You need to drop the typename and use ::template instead:

    using AReverse = A::template Sibling<Right, Left>;
    

    The identifier to the right of :: in this case (Sibling) is not a type, it’s a template, and that’s why this disambiguator is needed instead of typename.

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

Sidebar

Related Questions

i'm doing my first applications using JDBC/Oracle... Today i had a problem and i
I had the following problem today, and I was wondering if there is a
I had a performance problem today that showed up after some profiling. Calls to
I got a problem today. It had a method and I need to find
Today I have had a problem with hiding text with text-indent: -9999px rule. I
I have a big problem. I had a configuration which worked properly till today.
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had a Problem to use DotNet 4.0 DLL in a DotNet 2.0 Application,
I need to segment text using fullstops using PHP/Javascript.The problem is if I use
Today I had a problem with my old Eclipse 3.4 installation and I had

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.