Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions is_standard template.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// C++ program to illustrate
// std::is_standard_layout template

#include <iostream>
#include <type_traits>
using namespace std;

// Class with local variable
class gfg {
int variab;
};

// Structure with local variable
struct sam {
int variab;

private:
int variab_priv;
};

// Empty union
union raj {
};

// Driver code
int main()
{
cout << boolalpha;
cout << "Is gfg class a standard layout: "
<< is_standard_layout<gfg>::value << '\n';
cout << "Is structure sam a standard layout: "
<< is_standard_layout<sam>::value << '\n';
cout << "Is union raj a standard layout: "
<< is_standard_layout<raj>::value << '\n';
cout << "Is datatype char a standard layout: "
<< is_standard_layout<char>::value << '\n';
cout << "Is integer array 'int a[10]' a standard layout: "
<< is_standard_layout<int[10]>::value << '\n';

return 0;
}