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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:28:41+00:00 2026-05-23T18:28:41+00:00

I was trying out some CUDA/Thrust code on Linux/GCC and wanted to use some

  • 0

I was trying out some CUDA/Thrust code on Linux/GCC and wanted to use some TR1 libraries, when I noticed something peculiar: Most libraries will invariably pull in tr1_impl/type_traits (4.4) or just type_traits (4.6), and that header will always contain variadic templates, like so:

  template<typename _Res, typename... _ArgTypes>
    struct is_function<_Res(_ArgTypes...)>
    : public true_type { };

However, these headers also get used when I run GCC in C++98 or C++03 mode! How can this work?

The actual problem I encountered is that the CUDA toolchain doesn’t recognize C++0x constructions, and cudafe++ (the CUDA front end, i.e. the program that separates the joint source code into host and device source code) rightly aborts with an error when encountering the variadic template parameter.

So… how can GCC support and rely on variadic templates in non-0x dialects of C++? And is there a way to obtain a genuine C++03 version of TR1?

  • 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-23T18:28:42+00:00Added an answer on May 23, 2026 at 6:28 pm

    Welp, an implementation is not required to provide headers. It’s required that an #include <stuff> does The Right Thing. So that means that if an implementation decides to use headers for this functionality, it’s not required that those headers be conforming C++. And in fact GCC has supported variadic templates as an extension for quite some time.

    Furthermore, I can’t help but notice

    #pragma GCC system header
    

    in the <tr1/random> header that you mention. GCC will treat the file specially, and e.g. not report errors warnings in it. I would have thought using an extension in conforming mode can easily be turned into an error so I’m not sure what’s going on but at least legally it’s an option.

    There’s also the special status of TR1, which is not binding. On my implementation as far I can tell the only C++03 header that includes <type_traits> is <functional> and it properly only does that in C++0x mode (i.e. the rest of the time it’s a valid C++03 file via preprocessing, unlike <tr1/random>). (I didn’t check for other cases though.)

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

Sidebar

Related Questions

So, im trying to write some code that utilizes Nvidia's CUDA architecture. I noticed
I was trying out some c++ code while working with classes and this question
I am relatively new to Java and while trying out some code came across
I'm trying to figure out some C code so that I can port it
I've been trying out some of the view code from Erica Sadun's book The
I am trying to figure out how to use a CUDA kernel as part
I'm learning Objective-C and just trying out some sample code. I am getting the
I am trying to figure out some code that I was given. Can someone
I'm trying to factor out some repetitive code, but it starts to smell funky
I trying out some problems in Google's Code Jam. For the question Store Credit

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.