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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:31:01+00:00 2026-05-18T08:31:01+00:00

SFINAE allows us to detect if a type has certain data members or member

  • 0

SFINAE allows us to detect if a type has certain data members or member functions. Can it also be used to detect if a type exists at all? Background: I want to know whether <vector> was included or not.

  • 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-18T08:31:02+00:00Added an answer on May 18, 2026 at 8:31 am

    It can do, although I’ve only managed to make it work in C++0x.

    struct no_type {};
    struct is_vector_included {
        template<typename U> static decltype(std::vector<U>::iterator()) func( U* );
        template<typename U> static no_type func( ... );
        static const bool value = !std::is_same<no_type, decltype(func<int>(nullptr))>::value;
    };
    

    The structure is very curious and although there should be certain obvious simplifications, they don’t work. More importantly, why don’t you just #include <vector> to be certain?

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

Sidebar

Related Questions

Using SFINAE, i can detect wether a given class has a certain member function.
I'm trying to use SFINAE to detect if a class has an overloaded member
In C++0x SFINAE rules have been simplified such that any invalid expression or type
What is SFINAE in C++? Can you please explain it in words understandable to
I have an SFINAE test for checking if an class has a function. The
After reading the answer to this question , I learned that SFINAE can be
I want to detect existence of a specific member function for a class, using
A (somewhat) outdated article explores ways to use decltype along with SFINAE to detect
I'm trying tow write a SFINAE template to determine whether two classes can be
I am using a SFINAE mechanism to deduce a type. Resolve<T>::type is deduced to

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.