www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - detecting POD types

reply "japplegame" <japplegame gmail.com> writes:
I write function template that should works only with POD types 
(i.e. base types, structures, enums etc.). Is there something 
like C++11 std::is_pod 
(http://en.cppreference.com/w/cpp/types/is_pod) template?
May 20 2012
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I don't think there is, but maybe you could use some template
constraints from std.traits, like isPointer:
if (!isPointer!T && !is(T == class))

There's probably other cases to consider, I'll leave others to fill in.

On 5/20/12, japplegame <japplegame gmail.com> wrote:
 I write function template that should works only with POD types
 (i.e. base types, structures, enums etc.). Is there something
 like C++11 std::is_pod
 (http://en.cppreference.com/w/cpp/types/is_pod) template?
May 20 2012
prev sibling parent "David Nadlinger" <see klickverbot.at> writes:
On Sunday, 20 May 2012 at 13:50:17 UTC, japplegame wrote:
 I write function template that should works only with POD types 
 (i.e. base types, structures, enums etc.). Is there something 
 like C++11 std::is_pod 
 (http://en.cppreference.com/w/cpp/types/is_pod) template?
Sorry for resurrecting this old thread, but: What is your definition of "plain old data"? The D language doesn't have one. David
Dec 28 2012