Flutter Engine
The Flutter Engine
backend_cast.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_BASE_BACKEND_CAST_H_
6#define FLUTTER_IMPELLER_BASE_BACKEND_CAST_H_
7
8namespace impeller {
9
10template <class Sub, class Base>
12 public:
13 static Sub& Cast(Base& base) { return reinterpret_cast<Sub&>(base); }
14
15 static const Sub& Cast(const Base& base) {
16 return reinterpret_cast<const Sub&>(base);
17 }
18
19 static Sub* Cast(Base* base) { return reinterpret_cast<Sub*>(base); }
20
21 static const Sub* Cast(const Base* base) {
22 return reinterpret_cast<const Sub*>(base);
23 }
24};
25
26} // namespace impeller
27
28#endif // FLUTTER_IMPELLER_BASE_BACKEND_CAST_H_
static const Sub * Cast(const Base *base)
Definition: backend_cast.h:21
static Sub & Cast(Base &base)
Definition: backend_cast.h:13
static Sub * Cast(Base *base)
Definition: backend_cast.h:19
static const Sub & Cast(const Base &base)
Definition: backend_cast.h:15