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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:23:07+00:00 2026-05-13T23:23:07+00:00

Is there a way by which we can simulate thread level constants in C++?

  • 0

Is there a way by which we can simulate thread level constants in C++? For example, if i have to make a call to template functions, then i need to mention the constants as template level parameters? I can use static const variables for template metaprogramming, but they are process level constants.

I know, i am asking a question with a high probability of ‘No’. Just thought of asking this to capitalize on the very rare probability :))

On request, i am posting a sample code. Here i needed to track the enquiry, if it comes from one specific thread. I assume that, if i create that as my first thread, then it will get the thread id 1.

template<ACE_INT32 ThreadId>
bool enquire_presence( Manager* man)
{
      return check(man);
}


template<>
bool enquire_presence<1>( Manager* man )
{
      track_enquiry(man);
      return check(man);
}

Thanks,
Gokul.

  • 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-13T23:23:07+00:00Added an answer on May 13, 2026 at 11:23 pm

    Templates are compile time constructs, threads are run-time ones – there is no way of having templates specific to a thread.

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

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It works fine in IE 8. IE 7 and earlier… May 16, 2026 at 2:09 pm
  • Editorial Team
    Editorial Team added an answer The .hover() handler will fire once for mouseenter and once… May 16, 2026 at 2:09 pm
  • Editorial Team
    Editorial Team added an answer You could use base64_encode and base64_decode, it makes it less… May 16, 2026 at 2:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a probability problem, which I need to simulate in a reasonable amount
We have some users which are using lower-CPU powered machines and they're encountering slow
I have a lot of classes which are basically equivalent, ie have almost the
In binary search algorithm we have two comparisons: if (key == a[mid]) then found;
Is there a way to get CF9 ORM to insert NULL Values into the
Is there a way to generate a unique ref for a user? Maybe based
I have a Silverlight App which gets its data from a database. My Silverlight
I have a situation where I need to write some unit tests for some
My embedded project contains a Qt application for the PC which is mainly a
I've written a component in a Windows service (C#) which is responsible for sending

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.