chromium/third_party/mediapipe/src/mediapipe/framework/api2/tag.h

#ifndef MEDIAPIPE_FRAMEWORK_API2_TAG_H_
#define MEDIAPIPE_FRAMEWORK_API2_TAG_H_

#include <utility>

#include "mediapipe/framework/api2/const_str.h"

namespace mediapipe {
namespace api2 {

// This template is used to define a separate type for each tag.
// This makes it possible to obtain results of different types depending on
// the tag. See MPP_TAG below for usage examples.
template <char... C>
struct Tag {};

template <char... C>
constexpr bool is_tag(Tag<C...>) {}

template <typename A>
constexpr bool is_tag(A) {}

namespace internal {

template <typename S, std::size_t... I>
constexpr auto tag_build_impl(S,
                              std::index_sequence<I...>) -> Tag<S().tag[I]...> {}

template <typename S>
constexpr auto tag_build(S) {}

}  // namespace internal

// Use this to create typed tag objects.
// For example:
//   auto kFOO = MPP_TAG(FOO);
//   auto kBAR = MPP_TAG(BAR);
#define MPP_TAG(s)

}  // namespace api2
}  // namespace mediapipe

#endif  // MEDIAPIPE_FRAMEWORK_API2_TAG_H_