fix unused warning

This commit is contained in:
BlackMATov
2021-08-16 08:08:46 +07:00
parent 044590e782
commit 0e15e52272
2 changed files with 20 additions and 5 deletions

View File

@@ -34,9 +34,10 @@ namespace meta_hpp
template < typename... Args >
ctor_info get_ctor_by_args() const noexcept;
template < std::size_t Args >
ctor_info get_ctor_by_args(const std::array<any_type, Args>& args) const noexcept;
template < std::size_t N >
ctor_info get_ctor_by_args(const std::array<any_type, N>& args) const noexcept;
ctor_info get_ctor_by_args(const std::vector<any_type>& args) const noexcept;
ctor_info get_ctor_by_args(std::initializer_list<any_type> args) const noexcept;
public:
template < typename F >
void visit(F&& f) const;
@@ -137,8 +138,8 @@ namespace meta_hpp
return get_ctor_by_args(args);
}
template < std::size_t Args >
ctor_info class_info::get_ctor_by_args(const std::array<any_type, Args>& args) const noexcept {
template < std::size_t N >
ctor_info class_info::get_ctor_by_args(const std::array<any_type, N>& args) const noexcept {
for ( auto&& id_info : state_->ctors ) {
const std::vector<any_type>& ctor_args =
id_info.second.type().argument_types();
@@ -165,6 +166,20 @@ namespace meta_hpp
}
return ctor_info{};
}
inline ctor_info class_info::get_ctor_by_args(std::initializer_list<any_type> args) const noexcept {
for ( auto&& id_info : state_->ctors ) {
const std::vector<any_type>& ctor_args =
id_info.second.type().argument_types();
if ( args.size() == ctor_args.size()
&& std::equal(args.begin(), args.end(), ctor_args.begin()) )
{
return id_info.second;
}
}
return ctor_info{};
}
}
namespace meta_hpp

View File

@@ -68,7 +68,7 @@ namespace meta_hpp::detail
}
template < typename Member >
void raw_member_setter(Member member, const inst& inst, const arg& arg) {
void raw_member_setter([[maybe_unused]] Member member, const inst& inst, const arg& arg) {
using mt = member_pointer_traits<Member>;
using class_type = typename mt::class_type;
using value_type = typename mt::value_type;