Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove usage of "not" in public headers
This unfortunately makes compilation of project using LIEF with
cl.exe-like compilers really painful. Including "iso646.h" seems like a
hack, and does not seem to work with recent VS2019 versions.
  • Loading branch information
aguinetqb committed Mar 29, 2021
1 parent 06aa75c commit b8e825b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions include/LIEF/associative_iterators.hpp
Expand Up @@ -65,7 +65,7 @@ struct dict_iterator_pair {
return const_cast<add_const_t<key_ref_t>>(this->key_);
}

typename std::enable_if<not std::is_const<key_ref_t>::value, remove_const_t<key_ref_t>>::type
typename std::enable_if<!std::is_const<key_ref_t>::value, remove_const_t<key_ref_t>>::type
key(void) const {
return const_cast<remove_const_t<key_ref_t>>(static_cast<const dict_iterator_pair*>(this)->key());
}
Expand All @@ -74,7 +74,7 @@ struct dict_iterator_pair {
return const_cast<add_const_t<value_ref_t>>(*this->value_);
}

typename std::enable_if<not std::is_const<value_ref_t>::value, remove_const_t<value_ref_t>>::type
typename std::enable_if<!std::is_const<value_ref_t>::value, remove_const_t<value_ref_t>>::type
value(void) const {
return const_cast<remove_const_t<value_ref_t>>(static_cast<const dict_iterator_pair*>(this)->value());
}
Expand Down Expand Up @@ -185,7 +185,7 @@ class dict_iterator : public std::iterator<
}


//typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
//typename std::enable_if<!std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
//operator[](size_t n) {
// return const_cast<remove_const_t<ref_t>>(static_cast<const dict_iterator*>(this)->operator[](n));
//}
Expand Down Expand Up @@ -225,12 +225,12 @@ class dict_iterator : public std::iterator<


bool operator>=(const dict_iterator& rhs) const {
return not (*this < rhs);
return !(*this < rhs);
}


bool operator<=(const dict_iterator& rhs) const {
return not (*this > rhs);
return !(*this > rhs);
}

dict_iterator begin(void) const {
Expand All @@ -257,15 +257,15 @@ class dict_iterator : public std::iterator<
}

bool operator!=(const dict_iterator& other) const {
return not (*this == other);
return !(*this == other);
}

size_t size(void) const {
return this->container_.size();
}


typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
typename std::enable_if<!std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
operator*() {
return const_cast<remove_const_t<ref_t>>(static_cast<const dict_iterator*>(this)->operator*());
}
Expand All @@ -278,13 +278,13 @@ class dict_iterator : public std::iterator<
}

template<typename U = typename DT::value_type>
typename std::enable_if<not std::is_pointer<U>::value, add_const_t<ref_t>>::type
typename std::enable_if<!std::is_pointer<U>::value, add_const_t<ref_t>>::type
operator*() const {
return const_cast<add_const_t<ref_t>>(*(this->it_));
}


typename std::enable_if<not std::is_const<pointer_t>::value, pointer_t>::type
typename std::enable_if<!std::is_const<pointer_t>::value, pointer_t>::type
operator->() {
return const_cast<remove_const_t<pointer_t>>(static_cast<const ref_iterator*>(this)->operator->());
}
Expand Down
30 changes: 15 additions & 15 deletions include/LIEF/iterators.hpp
Expand Up @@ -124,7 +124,7 @@ class ref_iterator : public std::iterator<
}


typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
typename std::enable_if<!std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
operator[](size_t n) {
return const_cast<remove_const_t<ref_t>>(static_cast<const ref_iterator*>(this)->operator[](n));
}
Expand Down Expand Up @@ -174,12 +174,12 @@ class ref_iterator : public std::iterator<


bool operator>=(const ref_iterator& rhs) const {
return not (*this < rhs);
return !(*this < rhs);
}


bool operator<=(const ref_iterator& rhs) const {
return not (*this > rhs);
return !(*this > rhs);
}

ref_iterator begin(void) const {
Expand All @@ -206,15 +206,15 @@ class ref_iterator : public std::iterator<
}

bool operator!=(const ref_iterator& other) const {
return not (*this == other);
return !(*this == other);
}

size_t size(void) const {
return this->container_.size();
}


typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
typename std::enable_if<!std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
operator*() {
return const_cast<remove_const_t<ref_t>>(static_cast<const ref_iterator*>(this)->operator*());
}
Expand All @@ -227,13 +227,13 @@ class ref_iterator : public std::iterator<
}

template<typename U = typename DT::value_type>
typename std::enable_if<not std::is_pointer<U>::value, add_const_t<ref_t>>::type
typename std::enable_if<!std::is_pointer<U>::value, add_const_t<ref_t>>::type
operator*() const {
return const_cast<add_const_t<ref_t>>(*(this->it_));
}


typename std::enable_if<not std::is_const<pointer_t>::value, pointer_t>::type
typename std::enable_if<!std::is_const<pointer_t>::value, pointer_t>::type
operator->() {
return const_cast<remove_const_t<pointer_t>>(static_cast<const ref_iterator*>(this)->operator->());
}
Expand Down Expand Up @@ -283,7 +283,7 @@ class filter_iterator : public std::iterator<
this->it_ = std::begin(this->container_);

if (this->it_ != std::end(this->container_)) {
if (not std::all_of(std::begin(this->filters_), std::end(this->filters_), [this] (const filter_t& f) {return f(*this->it_);})) {
if (!std::all_of(std::begin(this->filters_), std::end(this->filters_), [this] (const filter_t& f) {return f(*this->it_);})) {
this->next();
}
}
Expand All @@ -299,7 +299,7 @@ class filter_iterator : public std::iterator<
this->it_ = std::begin(this->container_);

if (this->it_ != std::end(this->container_)) {
if (not std::all_of(std::begin(this->filters_), std::end(this->filters_), [this] (const filter_t& f) {return f(*this->it_);})) {
if (!std::all_of(std::begin(this->filters_), std::end(this->filters_), [this] (const filter_t& f) {return f(*this->it_);})) {
this->next();
}
}
Expand Down Expand Up @@ -377,7 +377,7 @@ class filter_iterator : public std::iterator<
return this->end();
}

typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
typename std::enable_if<!std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
operator*() {
return const_cast<remove_const_t<ref_t>>(static_cast<const filter_iterator*>(this)->operator*());
}
Expand All @@ -390,13 +390,13 @@ class filter_iterator : public std::iterator<
}

template<typename U = typename DT::value_type>
typename std::enable_if<not std::is_pointer<U>::value, add_const_t<ref_t>>::type
typename std::enable_if<!std::is_pointer<U>::value, add_const_t<ref_t>>::type
operator*() const {
return const_cast<add_const_t<ref_t>>(*(this->it_));
}


typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
typename std::enable_if<!std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
operator[](size_t n) {
return const_cast<remove_const_t<ref_t>>(static_cast<const filter_iterator*>(this)->operator[](n));
}
Expand All @@ -410,7 +410,7 @@ class filter_iterator : public std::iterator<
}


typename std::enable_if<not std::is_const<pointer_t>::value, pointer_t>::type
typename std::enable_if<!std::is_const<pointer_t>::value, pointer_t>::type
operator->() {
return const_cast<remove_const_t<pointer_t>>(static_cast<const filter_iterator*>(this)->operator->());
}
Expand Down Expand Up @@ -442,7 +442,7 @@ class filter_iterator : public std::iterator<
}

bool operator!=(const filter_iterator& other) const {
return not (*this == other);
return !(*this == other);
}

protected:
Expand All @@ -457,7 +457,7 @@ class filter_iterator : public std::iterator<
this->distance_++;
} while(
this->it_ != std::end(this->container_) and
not std::all_of(
!std::all_of(
std::begin(this->filters_),
std::end(this->filters_),
[this] (const filter_t& f) {
Expand Down

0 comments on commit b8e825b

Please sign in to comment.