Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3021

Compiler error 3848

$
0
0
I'm updating some code that previously built okay with VS2005:-

Code:

struct id_compare
{
        bool operator()(const boost::shared_ptr<Playlist>& p1, const boost::shared_ptr<Playlist>& p2)
        {
                return p1->id () < p2->id ();
        }
};


typedef std::set<boost::shared_ptr<Playlist> > List;
typedef std::set<boost::shared_ptr<Playlist>, id_compare> IDSortedList;


static void
get_id_sorted_playlists (const List& playlists, IDSortedList& id_sorted_playlists)
{
        for (List::const_iterator i = playlists.begin(); i != playlists.end(); ++i) {
                id_sorted_playlists.insert(*i); // <--- COMPILER ERROR C3848 HERE !!!!
        }
}

but VS2019 gives me this error at the above line:-

Quote:

error C3848: expression having type 'const id_compare' would lose some const-volatile qualifiers in order to call 'bool id_compare::operator ()(const boost::shared_ptr<ARDOUR::Playlist> &,const boost::shared_ptr<ARDOUR::Playlist> &)'
message : see reference to function template instantiation 'std::_Tree_find_result<std::_Tree_node<boost::shared_ptr<ARDOUR::Playlist>,std::_Default_allocator_traits<_Alloc>::void_pointer> *> std::_Tree<std::_Tset_traits<_Kty,_Pr,_Alloc,false>>::_Find_lower_bound<_Key>(const _Keyty &) const' being compiled
with
[
_Alloc=std::allocator<boost::shared_ptr<ARDOUR::Playlist>>,
_Kty=boost::shared_ptr<ARDOUR::Playlist>,
_Pr=id_compare,
_Key=boost::shared_ptr<ARDOUR::Playlist>,
_Keyty=boost::shared_ptr<ARDOUR::Playlist>
]
Can anyone see a problem with the above code? Or is it likely to be some kind of issue with the supplier (Playlist) object? :confused:

Viewing all articles
Browse latest Browse all 3021

Trending Articles