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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:12:25+00:00 2026-05-18T02:12:25+00:00

As I understand, template aliases in C++0x will allow us to do the following:

  • 0

As I understand, template aliases in C++0x will allow us to do the following:

template <typename T>
using Dictionary = std::map< std::string, T >;

Dictionary<int> ints;
ints[ "one" ] = 1;
ints[ "two" ] = 2;

I have two questions:

First, will we be able to do this (bind to any type, or just templates):

template <typename Iter>
using ValueType = std::iterator_traits<Iter>::value_type;

Second, will using the aliases require usage of the typename keyword in templates, e.g.:

template <typename Iter>
typename ValueType<Iter> sum(Iter first, Iter last) { ... }
// ^ required?

Or is it required in the alias declaration?

using ValueType = typename std::iterator_traits<Iter>::value_type;
//                   ^ required?

Or neither?

  • 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-18T02:12:26+00:00Added an answer on May 18, 2026 at 2:12 am

    The syntax is:

    template <typename Iter>
    using ValueType = typename std::iterator_traits<Iter>::value_type;
    

    as with your second one.

    Source:
    http://www2.research.att.com/~bs/C++0xFAQ.html#template-alias

    Their example is:

    template<int N>
        using int_exact = typename int_exact_traits<N>::type;  // define alias for convenient notation
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just try to understand the behaviour of the following situation: template <typename T1>
I don't understand very well the std::move function template <class T> typename remove_reference<T>::type&& move(T&&
I'm trying to expose the following c++ function to python using boost.python: template <typename
I do not understand how this piece of code (from Wikipedia) works: template <int
As i Understand export keyword can be used so that one can expose template
I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. Major is
I understand the difference between String and StringBuilder ( StringBuilder being mutable) but is
I understand that the Express edition doesn't template unit test projects... but being a
I am trying to understand some C++ syntax: template<class T> class Foo { Foo();
I can't understand, why if we define static variable of usual (non-template) class in

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.