Flutter Engine
The Flutter Engine
SkTLogic.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 *
7 *
8 * This header provides some std:: features early in the skstd namespace
9 * and several Skia-specific additions in the sknonstd namespace.
10 */
11
12#ifndef SkTLogic_DEFINED
13#define SkTLogic_DEFINED
14
15#include <iterator>
16#include <type_traits>
18
19// The sknonstd namespace contains things we would like to be proposed and feel std-ish.
20namespace sknonstd {
21
22// The name 'copy' here is fraught with peril. In this case it means 'append', not 'overwrite'.
23// Alternate proposed names are 'propagate', 'augment', or 'append' (and 'add', but already taken).
24// std::experimental::propagate_const already exists for other purposes in TSv2.
25// These also follow the <dest, source> pattern used by boost.
26template <typename D, typename S> struct copy_const {
27 using type = std::conditional_t<std::is_const<S>::value, std::add_const_t<D>, D>;
28};
29template <typename D, typename S> using copy_const_t = typename copy_const<D, S>::type;
30
31template <typename D, typename S> struct copy_volatile {
32 using type = std::conditional_t<std::is_volatile<S>::value, std::add_volatile_t<D>, D>;
33};
34template <typename D, typename S> using copy_volatile_t = typename copy_volatile<D, S>::type;
35
36template <typename D, typename S> struct copy_cv {
38};
39template <typename D, typename S> using copy_cv_t = typename copy_cv<D, S>::type;
40
41// The name 'same' here means 'overwrite'.
42// Alternate proposed names are 'replace', 'transfer', or 'qualify_from'.
43// same_xxx<D, S> can be written as copy_xxx<remove_xxx_t<D>, S>
44template <typename D, typename S> using same_const = copy_const<std::remove_const_t<D>, S>;
45template <typename D, typename S> using same_const_t = typename same_const<D, S>::type;
46template <typename D, typename S> using same_volatile =copy_volatile<std::remove_volatile_t<D>,S>;
47template <typename D, typename S> using same_volatile_t = typename same_volatile<D, S>::type;
48template <typename D, typename S> using same_cv = copy_cv<std::remove_cv_t<D>, S>;
49template <typename D, typename S> using same_cv_t = typename same_cv<D, S>::type;
50
51} // namespace sknonstd
52
53template <typename Container>
54constexpr int SkCount(const Container& c) { return SkTo<int>(std::size(c)); }
55
56#endif
constexpr int SkCount(const Container &c)
Definition: SkTLogic.h:54
uint8_t value
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
typename same_cv< D, S >::type same_cv_t
Definition: SkTLogic.h:49
typename copy_volatile< D, S >::type copy_volatile_t
Definition: SkTLogic.h:34
typename same_volatile< D, S >::type same_volatile_t
Definition: SkTLogic.h:47
typename same_const< D, S >::type same_const_t
Definition: SkTLogic.h:45
typename copy_const< D, S >::type copy_const_t
Definition: SkTLogic.h:29
typename copy_cv< D, S >::type copy_cv_t
Definition: SkTLogic.h:39
std::conditional_t< std::is_const< S >::value, std::add_const_t< D >, D > type
Definition: SkTLogic.h:27
copy_volatile_t< copy_const_t< D, S >, S > type
Definition: SkTLogic.h:37
std::conditional_t< std::is_volatile< S >::value, std::add_volatile_t< D >, D > type
Definition: SkTLogic.h:32