Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template hasProperty(alias T, string property){
- static if( __traits( compiles, { auto test = T.init; } ) )
- {
- enum bool hasProperty = is(typeof({
- mixin(`auto property = T.init.` ~ property ~ `;`);
- }));
- }
- else
- {
- enum bool hasProperty = is(typeof({
- mixin(`auto property = T.` ~ property ~ `;`);
- }));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement