Files
meta.hpp/headers/meta.hpp/meta_indices/method_index.hpp
2022-02-05 05:56:22 +07:00

42 lines
1.4 KiB
C++

/*******************************************************************************
* This file is part of the "https://github.com/blackmatov/meta.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2021, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#pragma once
#include "../meta_base.hpp"
#include "../meta_indices.hpp"
#include "../meta_types.hpp"
#include "../meta_detail/type_registry.hpp"
namespace meta_hpp
{
inline method_index::method_index(method_type type, std::string name)
: type_{std::move(type)}
, name_{std::move(name)} {}
template < detail::method_kind Method >
method_index method_index::make(std::string name) {
return method_index{detail::resolve_type<Method>(), std::move(name)};
}
inline const method_type& method_index::get_type() const noexcept {
return type_;
}
inline const std::string& method_index::get_name() const noexcept {
return name_;
}
inline bool operator<(const method_index& l, const method_index& r) noexcept {
return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_);
}
inline bool operator==(const method_index& l, const method_index& r) noexcept {
return l.type_ == r.type_ && l.name_ == r.name_;
}
}