@@ -39,6 +39,11 @@ Author: Daniel Poetzl
39
39
CV typename sharing_mapt<keyT, valueT, hashT, predT>::ST \
40
40
sharing_mapt<keyT, valueT, hashT, predT>
41
41
42
+ // Note: Due to a bug in Visual Studio we need to add an additional "const"
43
+ // qualifier to the return values of insert(), place(), and find(). The type
44
+ // defined in sharing_mapt already includes the const qualifier, but it is lost
45
+ // when accessed from outside the class. This is fixed in Visual Studio 15.6.
46
+
42
47
// / A map implemented as a tree where subtrees can be shared between different
43
48
// / maps.
44
49
// /
@@ -673,10 +678,8 @@ SHARING_MAPT2(, size_type)::erase_all(
673
678
// / (possible values `false` or `unknown`)
674
679
// / \return Pair of const reference to existing or newly inserted element, and
675
680
// / boolean indicating if new element was inserted
676
- SHARING_MAPT2 (, const_find_type)::insert(
677
- const key_type &k,
678
- const mapped_type &m,
679
- const tvt &key_exists)
681
+ SHARING_MAPT2 (const , const_find_type)
682
+ ::insert(const key_type &k, const mapped_type &m, const tvt &key_exists)
680
683
{
681
684
_sn_assert (!key_exists.is_true ());
682
685
@@ -697,9 +700,8 @@ SHARING_MAPT2(, const_find_type)::insert(
697
700
}
698
701
699
702
// Insert element, return const reference
700
- SHARING_MAPT2 (, const_find_type)::insert(
701
- const value_type &p,
702
- const tvt &key_exists)
703
+ SHARING_MAPT2 (const , const_find_type)
704
+ ::insert(const value_type &p, const tvt &key_exists)
703
705
{
704
706
return insert (p.first , p.second , key_exists);
705
707
}
@@ -714,9 +716,7 @@ SHARING_MAPT2(, const_find_type)::insert(
714
716
// / \param m: The mapped value to insert
715
717
// / \return Pair of reference to existing or newly inserted element, and boolean
716
718
// / indicating if new element was inserted
717
- SHARING_MAPT2 (, find_type)::place(
718
- const key_type &k,
719
- const mapped_type &m)
719
+ SHARING_MAPT2 (const , find_type)::place(const key_type &k, const mapped_type &m)
720
720
{
721
721
node_type *c=get_container_node (k);
722
722
_sm_assert (c!=nullptr );
@@ -733,8 +733,7 @@ SHARING_MAPT2(, find_type)::place(
733
733
}
734
734
735
735
// / Insert element, return non-const reference
736
- SHARING_MAPT2 (, find_type)::place(
737
- const value_type &p)
736
+ SHARING_MAPT2 (const , find_type)::place(const value_type &p)
738
737
{
739
738
return place (p.first , p.second );
740
739
}
@@ -750,9 +749,7 @@ SHARING_MAPT2(, find_type)::place(
750
749
// / (possible values `unknown` or `true`)
751
750
// / \return Pair of reference to found value (or dummy value if not found), and
752
751
// / boolean indicating if element was found.
753
- SHARING_MAPT2 (, find_type)::find(
754
- const key_type &k,
755
- const tvt &key_exists)
752
+ SHARING_MAPT2 (const , find_type)::find(const key_type &k, const tvt &key_exists)
756
753
{
757
754
_sm_assert (!key_exists.is_false ());
758
755
@@ -778,7 +775,7 @@ SHARING_MAPT2(, find_type)::find(
778
775
// / \param k: The key of the element to search
779
776
// / \return Pair of const reference to found value (or dummy value if not
780
777
// / found), and boolean indicating if element was found.
781
- SHARING_MAPT2 (, const_find_type)::find(const key_type &k) const
778
+ SHARING_MAPT2 (const , const_find_type)::find(const key_type &k) const
782
779
{
783
780
const node_type *p=get_leaf_node (k);
784
781
0 commit comments