@@ -701,6 +701,19 @@ TEST(StringMapCustomTest, NonConstIterator) {
701701 static_assert (
702702 std::is_same_v<decltype (Map.begin ()), StringMap<int >::iterator>);
703703
704+ // Check that the value_type of a non-const iterator is not a const type.
705+ static_assert (
706+ !std::is_const_v<StringMap<int >::iterator::value_type>,
707+ " The value_type of a non-const iterator should not be a const type." );
708+
709+ // Check that pointer and reference types are not const.
710+ static_assert (
711+ std::is_same_v<StringMap<int >::iterator::pointer,
712+ StringMap<int >::iterator::value_type *>);
713+ static_assert (
714+ std::is_same_v<StringMap<int >::iterator::reference,
715+ StringMap<int >::iterator::value_type &>);
716+
704717 // Check that we can construct a const_iterator from an iterator.
705718 static_assert (std::is_constructible_v<StringMap<int >::const_iterator,
706719 StringMap<int >::iterator>);
@@ -718,6 +731,19 @@ TEST(StringMapCustomTest, ConstIterator) {
718731 static_assert (std::is_same_v<decltype (ConstMap.begin ()),
719732 StringMap<int >::const_iterator>);
720733
734+ // Check that the value_type of a const iterator is not a const type.
735+ static_assert (
736+ !std::is_const_v<StringMap<int >::const_iterator::value_type>,
737+ " The value_type of a const iterator should not be a const type." );
738+
739+ // Check that pointer and reference types are const.
740+ static_assert (
741+ std::is_same_v<StringMap<int >::const_iterator::pointer,
742+ const StringMap<int >::const_iterator::value_type *>);
743+ static_assert (
744+ std::is_same_v<StringMap<int >::const_iterator::reference,
745+ const StringMap<int >::const_iterator::value_type &>);
746+
721747 // Check that we cannot construct an iterator from a const_iterator.
722748 static_assert (!std::is_constructible_v<StringMap<int >::iterator,
723749 StringMap<int >::const_iterator>);
0 commit comments