Skip to content
Snippets Groups Projects
Commit 6d2b1486 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

tidy: remove unused type details for array

parent 95a88795
No related branches found
No related tags found
1 merge request!224Tidy fixes following the merger of new normalization
......@@ -62,13 +62,6 @@ struct type_details_retriever < T * > {
}
};
 
template < class T, size_t S >
struct type_details_retriever < T [ S ] > {
static std::unique_ptr < type_details_base > get ( ) {
return std::make_unique < type_details_array > ( std::is_const_v < T >, S, type_details_retriever < std::decay_t < T > >::get ( ) );
}
};
template < class T >
struct type_details_retriever < const T && > {
static std::unique_ptr < type_details_base > get ( ) {
......
......@@ -195,45 +195,6 @@ bool type_details_pointer::operator == ( const type_details_pointer & other ) co
 
// --------------------------------------------------------------------------------------------------------------------------------------------------
 
void type_details_array::print ( std::ostream & os ) const {
os << (m_is_const_qualified ? "const " : "" ) << * m_sub_type << "[" << m_length << "]";
}
type_details_array::type_details_array ( bool is_const_qualified, size_t length, std::unique_ptr < type_details_base > sub_type ) : m_is_const_qualified ( is_const_qualified ), m_length ( length ), m_sub_type ( std::move ( sub_type ) ) {
}
bool type_details_array::compatible_with ( const type_details_base & other ) const {
auto casted = dynamic_cast < const type_details_array * > ( & other );
if ( casted == nullptr )
return false;
return m_is_const_qualified == casted->m_is_const_qualified && m_length == casted->m_length && m_sub_type->compatible_with ( * casted->m_sub_type );
}
std::strong_ordering type_details_array::operator <=> ( const type_details_base & other ) const {
if ( ext::type_index ( typeid ( * this ) ) != ext::type_index ( typeid ( other ) ) )
return ext::type_index ( typeid ( * this ) ) <=> ext::type_index ( typeid ( other ) );
return * this <=> static_cast < decltype ( ( * this ) ) > ( other );
}
std::strong_ordering type_details_array::operator <=> ( const type_details_array & other ) const {
return std::tie ( m_is_const_qualified, m_length, * m_sub_type ) <=> std::tie ( other.m_is_const_qualified, m_length, * other.m_sub_type );
}
bool type_details_array::operator == ( const type_details_base & other ) const {
if ( ext::type_index ( typeid ( * this ) ) != ext::type_index ( typeid ( other ) ) )
return false;
return * this == static_cast < decltype ( ( * this ) ) > ( other );
}
bool type_details_array::operator == ( const type_details_array & other ) const {
return std::tie ( m_is_const_qualified, m_length, * m_sub_type ) == std::tie ( other.m_is_const_qualified, m_length, * other.m_sub_type );
}
// --------------------------------------------------------------------------------------------------------------------------------------------------
void type_details_reference::print ( std::ostream & os ) const {
os << (m_is_const_qualified ? "const " : "" ) << * m_sub_type << ( m_is_rvalue ? " &&" : " &" );
}
......
......@@ -113,28 +113,6 @@ public:
bool operator == ( const type_details_pointer & other ) const;
};
 
class type_details_array : public type_details_base {
bool m_is_const_qualified;
size_t m_length;
std::unique_ptr < type_details_base > m_sub_type;
void print ( std::ostream & os ) const override;
public:
type_details_array ( bool is_const_qualified, size_t length, std::unique_ptr < type_details_base > sub_type );
bool compatible_with ( const type_details_base & other ) const override;
std::strong_ordering operator <=> ( const type_details_base & other ) const override;
std::strong_ordering operator <=> ( const type_details_array & other ) const;
bool operator == ( const type_details_base & other ) const override;
bool operator == ( const type_details_array & other ) const;
};
class type_details_reference : public type_details_base {
bool m_is_const_qualified;
bool m_is_rvalue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment