Skip to content

Commit

Permalink
Fix bogus const_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
tinloaf committed Dec 6, 2019
1 parent c43aecf commit b585bed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/bst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ typename BinarySearchTree<Node, Options, Tag, Compare,
BinarySearchTree<Node, Options, Tag, Compare, ParentContainer>::find(
const Comparable & query) const CMP_NOEXCEPT(query)
{
return const_iterator<false>(const_cast<decltype(this)>(this)->find(query));
return const_iterator<false>(
const_cast<std::remove_const_t<decltype(this)>>(this)->find(query));
}

template <class Node, class Options, class Tag, class Compare,
Expand Down
4 changes: 3 additions & 1 deletion src/energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Just to make this file compileable for clangd
#include "energy.hpp"

#include "debug.hpp"

#include <cassert>
Expand Down Expand Up @@ -801,7 +802,8 @@ template <class Comparable>
typename EnergyTree<Node, Options, Tag, Compare>::template const_iterator<false>
EnergyTree<Node, Options, Tag, Compare>::find(const Comparable & query) const
{
return const_iterator<false>(const_cast<decltype(this)>(this)->find(query));
return const_iterator<false>(
const_cast<std::remove_const_t<decltype(this)>>(this)->find(query));
}

template <class Node, class Options, class Tag, class Compare>
Expand Down

0 comments on commit b585bed

Please sign in to comment.