1/* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef ANDROID_HWUI_PAIR_H 18#define ANDROID_HWUI_PAIR_H 19 20#include <utils/TypeHelpers.h> 21 22namespace android { 23namespace uirenderer { 24 25template <typename F, typename S> 26struct Pair { 27 F first; 28 S second; 29 30 Pair() { } 31 Pair(const Pair& o) : first(o.first), second(o.second) { } 32 Pair(const F& f, const S& s) : first(f), second(s) { } 33 34 inline const F& getFirst() const { 35 return first; 36 } 37 38 inline const S& getSecond() const { 39 return second; 40 } 41}; 42 43}; // namespace uirenderer 44 45template <typename F, typename S> 46struct trait_trivial_ctor< uirenderer::Pair<F, S> > 47{ enum { value = aggregate_traits<F, S>::has_trivial_ctor }; }; 48template <typename F, typename S> 49struct trait_trivial_dtor< uirenderer::Pair<F, S> > 50{ enum { value = aggregate_traits<F, S>::has_trivial_dtor }; }; 51template <typename F, typename S> 52struct trait_trivial_copy< uirenderer::Pair<F, S> > 53{ enum { value = aggregate_traits<F, S>::has_trivial_copy }; }; 54template <typename F, typename S> 55struct trait_trivial_move< uirenderer::Pair<F, S> > 56{ enum { value = aggregate_traits<F, S>::has_trivial_move }; }; 57 58}; // namespace android 59 60#endif // ANDROID_HWUI_PAIR_H 61