[M94 Dev][Tizen] Fix for errors for generating ninja files
[platform/framework/web/chromium-efl.git] / base / as_const.h
1 // Copyright 2021 The Chromium 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 BASE_AS_CONST_H_
6 #define BASE_AS_CONST_H_
7
8 #include <type_traits>
9
10 namespace base {
11
12 // C++14 implementation of C++17's std::as_const():
13 // https://en.cppreference.com/w/cpp/utility/as_const
14 template <typename T>
15 constexpr std::add_const_t<T>& as_const(T& t) noexcept {
16   return t;
17 }
18
19 template <typename T>
20 void as_const(const T&& t) = delete;
21
22 }  // namespace base
23
24 #endif  // BASE_AS_CONST_H_