-
January 21st, 2021, 07:41 AM
#1
Compiler error 3848
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:-
error C3848: expression having type 'const id_compare' would lose some const-volatile qualifiers in order to call 'bool id_compare: perator ()(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?
"A problem well stated is a problem half solved.” - Charles F. Kettering
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|