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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:28:06+00:00 2026-05-31T06:28:06+00:00

I asked this question earlier where a solution was presented. The solution is great

  • 0

I asked this question earlier where a solution was presented. The solution is great as far as the question is concerned, but now I am confused on how I would define the methods outside of the class i.e. I would like to define the methods in an .inl file. What would be the syntax in this case?

Just to be clear, for a template class, the method definition will be:

template <typename T>
struct Foo
{
  Foo();
};

// C-tor definition
template <typename T>
Foo<T>::Foo()
{
}

How would I define methods for the template class with enable_if as one of the parameters?

template <typename Policy, enable_if< is_base<BasePolicy, Policy>::value >::type >
struct Foo
{
  Foo();
};

// C-tor definition -- ???
  • 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-31T06:28:07+00:00Added an answer on May 31, 2026 at 6:28 am

    From the looks of it, you want to do something along the lines of this:

    template <typename Policy,
              typename = typename std::enable_if<std::is_base_of<BasePolicy, Policy>::value>::type >
    struct Foo;
    
    template <typename Policy>
    struct Foo<Policy> {
        Foo();
    };
    
    template <typename Policy>
    Foo<Policy>::Foo() {
    }
    

    This sneakily takes advantage of the default argument in a few places: don’t get confused, there is an implicit void sitting in several locations.

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

Sidebar

Related Questions

I asked this question earlier. I am intrigued by std::set but I have another
I asked this question earlier and am now trying to explore the idea of
This question was asked earlier by someone else but never answered: MKAnnotation - Map
You may think this question is like this question asked on StackOverflow earlier. But
I asked this question earlier, but it got a negative vote, so I'm rewording
I asked this question earlier but I was very vague and a lot of
I asked this question earlier but regarding another programming languages. Let's say I have
I asked this question earlier but I didn't express myself correctly. If I have
I asked this question earlier, but I'm missing one important thing. I have a
I have asked this question earlier today but I didn't provide enough information and

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.