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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:24:20+00:00 2026-06-05T00:24:20+00:00

I currently have a constructor for a class that is : template<class TX, class

  • 0

I currently have a constructor for a class that is :

template<class TX, class TY> MyClass(const TX &x, const TY &y)

and allow me to construct my class based on 2 values.

I would like to be able to construct my class with random generators/engines from C++ 2011.

template<class TG, class TE> MyClass(TG &generator, TE &engine)

How to modify this last constructor because, in that form, it is the same thing as the first one for the compiler. I think I can use SFINAE but I don’t know how.

Thank you very much !

  • 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-05T00:24:21+00:00Added an answer on June 5, 2026 at 12:24 am

    What do the TX and TY arguments represent in the first constructor? To use SFINAE, you have to find some aspect of the APIs of the generator and engine that’s reliably distinct from TX and TY, such as a member variable or function. The seed function might be a good candidate. The general techniques for checking for a member function with a known signature are documented in another answer here: Is it possible to write a template to check for a function's existence?

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

Sidebar

Related Questions

I have a class something like that: template <class T> class bag { public:
We have some code that looks like this: class Serializer { public: template<class Type>
I currently have a base class Expr and some derivatives like AddExpr , MultExpr
Possible Duplicate: C++ invoke explicit template constructor First imagine I have a class Data
I have a template Vector class for 3D vector math. I'd like to have
I currently have a class called Polynomial, The initialization looks like this: def __init__(self,
I have an std::vector -like class that is compiled with Visual C++ 2008. There's
I have a class that has overloaded constructors. I'd like to re-factor the code
I want to Constraint that the Derived Class must have a Default Constructor. I
I have a class that accepts an existing PDO connection in the constructor: class

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.