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

  • Home
  • SEARCH
  • 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 8607389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:20:45+00:00 2026-06-12T03:20:45+00:00

Is it ever possible that in the following setup template <typename T> inline void

  • 0

Is it ever possible that in the following setup

template <typename T>
inline void id() {
    //...
}

template <typename T>
bool check() {
    return &id<T> == &id<T const>;
}

check will return true for some T? Does it depend on what is being done inside id? What does the standard have to say about this?

  • 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-12T03:20:47+00:00Added an answer on June 12, 2026 at 3:20 am

    Sure. Try const int or int& or void().


    There’s a rule that top-level const qualifiers collapse if you get multiple of them through a typedef or a template argument, which means check<int const>() will return true.

    [normative text pending]

    Then there’s a rule that ignores top-level const on things it doesn’t work on, like references or function types. That means check<int&> and check<int()> will return true.

    §8.3.2 [dcl.ref] p1

    Cv-qualified references are ill-formed except when the cv-qualifiers are introduced through the use of a typedef (7.1.3) or of a template type argument (14.3), in which case the cv-qualifiers are ignored.

    and

    §4.4 [conv.qual] p3

    [ Note: Function types (including those used in pointer to member function types) are never cv-qualified (8.3.5). —end note ]

    §8.5.3 [dcl.fct] p6

    The effect of a cv-qualifier-seq in a function declarator is not the same as adding cv-qualification on top of the function type. In the latter case, the cv-qualifiers are ignored.

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

Sidebar

Related Questions

I'm wondering if this kind of thing will ever be possible in PHP (and
Is it possible for the sizeof operator to ever return 0 (zero) in C
I wonder if it's ever possible to 'secure' wine; like for a user not
Not ever sure if it can be done, but is it possible to use
Possible Duplicate: Where are $_SESSION variables stored? When ever we working with session, we
is it possible to use SQLite for a j2me application ? has anyone ever
My first question ever, so I'll try to be as descriptive as possible. I
I am working on an enterprise system that will utilise a RESTful web service
The following (simplified and obfuscated) query appears to (in my mind) return a varchar
I have the following code for adding buttons in ever row of a DataGrid:

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.