Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

// Protocol Buffers - Google's data interchange format
// Copyright 2024 Google LLC. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#ifndef GOOGLE_PROTOBUF_HPB_TEMPLATE_HELP_H__
#define GOOGLE_PROTOBUF_HPB_TEMPLATE_HELP_H__
#include <type_traits>
#include "google/protobuf/hpb/ptr.h"
namespace hpb {
namespace internal {
template <typename T>
struct RemovePtr;
template <typename T>
struct RemovePtr<Ptr<T>> {
using type = T;
};
template <typename T>
struct RemovePtr<T*> {
using type = T;
};
template <typename T>
using RemovePtrT = typename RemovePtr<T>::type;
template <typename T, typename U = RemovePtrT<T>,
typename = std::enable_if_t<!std::is_const_v<U>>>
using PtrOrRaw = T;
template <typename T>
using EnableIfHpbClass = std::enable_if_t<
std::is_base_of<typename T::Access, T>::value &&
std::is_base_of<typename T::Access, typename T::ExtendableType>::value>;
template <typename T>
using EnableIfMutableProto = std::enable_if_t<!std::is_const<T>::value>;
} // namespace internal
} // namespace hpb
#endif // GOOGLE_PROTOBUF_HPB_TEMPLATE_HELP_H__