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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:04:14+00:00 2026-05-23T07:04:14+00:00

I am going over the WildMagic 5 engine ( www.geometrictools.com ) where the Vector<>

  • 0

I am going over the WildMagic 5 engine (http://www.geometrictools.com) where the Vector<> class is inheriting from a Tuple<> class which has an array of a particular size, named mTuple[] (set by a template parameter). So far so good, nothing special. In the Vector class however, I see the following:

protected:
    using Tuple<4,Real>::mTuple; 

Now I know that the using keyword is used for inheriting overloaded methods properly. In this case, I always assumed the variable was available to the derived class without typing the above code. Is the above necessary? Or is it just there to make things clearer?

  • 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-23T07:04:14+00:00Added an answer on May 23, 2026 at 7:04 am

    Generic programming is slightly different from object oriented programming.

    Your mTuple is an example of a nondependent name. As far as the compiler is concerned, at the time the template definition is processed the compiler doesn’t know that the class template has inherited a data member named mTuple. It might be obvious to you, but it is not obvious to the compiler. At this stage, the compiler is oblivious to the obvious.

    If the methods of the derived class template wish to use some member of the parent class template, the compiler needs to be explicitly told to do so. Hence the using.

    Edit

    The above was a bit terse. It is important to remember that those class templates are not classes. They are templates that eventually define a class. Up until the moment that the class template is used to define a class that class template isn’t quite real. More importantly, for a class template that inherits from some other class template, that inheritance isn’t quite real. The compiler doesn’t know about that inheritance unless it is explicitly told about it. That’s why you will see derived class templates import the parent class’s members via using ParentClass<Type>::member (for example).

    Edit #2

    Marshall Cline discusses this topic in his C++-FAQ at http://www.parashift.com/c++-faq-lite/templates.html#faq-35.19

    Edit #3

    (Per request) Just because some code compiles on your compiler does not mean it compiles on every compiler (for the same language). Compiler vendors add their own ‘features’ to a language, sometimes very intentionally, sometimes just because the vendors themselves goofed up, and sometimes because the standard itself is buggy. This issue of not-quite-standard compilers has been a problem for a long time, with many languages. The problem apparently is quite rampant when it comes to generic programming.

    You can do everything right (or so you think): Turn on all standard warnings and then some, run your code through some commercial code analyzer, and you still might not have portable code.

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

Sidebar

Related Questions

I'm going over the following book - http://www.amazon.com/Algorithms-4th-Robert-Sedgewick/dp/032157351X and one of the sections talks
I'm currently going over pointers in class and our textbook is confusing me a
I was just going over the OBJECT element in HTML ( http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.3 ) .
I have spent a while going over all of the examples on http://www.silverlight.net/learn/quickstarts/ And
I'm preparing for an exam and after going over some sample exercises (which have
I am going over a sample project from Apple called Mixer Host. In the
My Java classes organization has gotten a little messy so I'm going over something
I was going over a sample Cocoa app from Apple (ImageKitDemo) and noticed that
I'm going over this in my theory class, and I'm curious as to how
Been going over my predecessor's code and see usage of the request scope frequently.

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.