Skip to content
Related Articles
Open in App
Not now

Related Articles

std::is_constructible template in C++ with Examples

Improve Article
Save Article
  • Last Updated : 12 Dec, 2022
Improve Article
Save Article

The std::is_constructible template of C++ STL is present in the <type_traits> header file. The std::is_constructible template of C++ STL is used to check whether the given type T is constructible type with the set of arguments or not. It return the boolean value true if T is of constructible type, Otherwise return false. Header File:


Template Class:

template <class T, class... Args>
struct is_constructible;




  • T: It represent the data type.
  • Args: It represent the list of data type T.

Return Value: This template returns a boolean variable as shown below:

  • True: If the type T is constructible.
  • False: If the type T is not constructible.

Below is the program to illustrates the std::is_constructible template in C/C++: Program: 


// C++ program to illustrate
// std::is_constructible example
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;
// Declare structures
struct A {
struct T {
    T(int, int){};
// Driver Code
int main()
    cout << std::boolalpha;
    // Check if <int> is
    // constructible or not
    cout << "int: "
         << is_constructible<int>::value
         << endl;
    // Check if <int, float> is
    // constructible or not
    cout << "int(float): "
         << is_constructible<int, float>::value
         << endl;
    // Check if <int, float, float> is
    // constructible or not
    cout << "int(float, float): "
         << is_constructible<int, float, float>::value
         << endl;
    // Check if struct T is
    // constructible or not
    cout << "T: "
         << is_constructible<T>::value
         << endl;
    // Check if struct <T, int> is
    // constructible or not
    cout << "T(int): "
         << is_constructible<T, int>::value
         << endl;
    // Check if struct <T, int, int> is
    // constructible or not
    cout << "T(int, int): "
         << is_constructible<T, int, int>::value
         << endl;
    return 0;


int: true
int(float): true
int(float, float): false
T: false
T(int): false
T(int, int): true


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!