1 #ifndef __DALI_TYPE_TRAITS_H__
2 #define __DALI_TYPE_TRAITS_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 * @brief Basic type traits that every type has by default
26 * This allows specialisations to not have to repeat all flags
28 template <typename Type>
32 * This flag tells Dali if a class can be considered POD. If it declares copy constructor and/or destructor, its not considered trivial
33 * and cannot be copied by using memcpy etc.
35 enum { IS_TRIVIAL_TYPE = __has_trivial_destructor(Type) && __has_trivial_copy(Type) };
39 * @brief Type traits support
40 * An example of overriding a traits flag for a custom type can be done by:
44 * /// Tell DALi that Matrix is POD, even though it has a copy constructor
45 * template <> struct TypeTraits< Matrix > : public BasicTypes< Matrix > { enum { IS_TRIVIAL_TYPE = true }; };
49 template <typename Type>
50 struct TypeTraits : public BasicTypes< Type >
56 #endif /* __DALI_TYPE_TRAITS_H__ */