chromium/mojo/public/cpp/bindings/clone_traits.h

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_PUBLIC_CPP_BINDINGS_CLONE_TRAITS_H_
#define MOJO_PUBLIC_CPP_BINDINGS_CLONE_TRAITS_H_

#include <optional>
#include <type_traits>
#include <utility>
#include <vector>

#include "base/containers/flat_map.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"

namespace mojo {

template <typename T, typename SFINAE = void>
struct HasCloneMethod : std ::false_type {};

HasCloneMethod<T, std::void_t<decltype(std::declval<const T &>().Clone())>>;

template <typename T>
T Clone(const T& input);

template <typename T>
struct CloneTraits {};

CloneTraits<std::optional<T>>;

CloneTraits<std::vector<T>>;

CloneTraits<base::flat_map<K, V>>;

template <typename T>
T Clone(const T& input) {}

}  // namespace mojo

#endif  // MOJO_PUBLIC_CPP_BINDINGS_CLONE_TRAITS_H_