-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds
FeatureModelConstraint
iterator and bindings (#114)
- Loading branch information
Showing
11 changed files
with
227 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef VARA_UTILS_UNIQUEITERATOR_H | ||
#define VARA_UTILS_UNIQUEITERATOR_H | ||
|
||
#include <type_traits> | ||
|
||
namespace vara { | ||
|
||
//===----------------------------------------------------------------------===// | ||
// UniqueIterator Class | ||
//===----------------------------------------------------------------------===// | ||
|
||
template <typename ContainerTy, | ||
typename ContainedTy = typename ContainerTy::value_type::element_type, | ||
typename IteratorTy = | ||
typename std::conditional<std::is_const<ContainerTy>::value, | ||
typename ContainerTy::const_iterator, | ||
typename ContainerTy::iterator>::type> | ||
class UniqueIterator { | ||
public: | ||
UniqueIterator(IteratorTy Iterator) : Iterator{Iterator} {} | ||
UniqueIterator(const UniqueIterator &) = default; | ||
UniqueIterator &operator=(const UniqueIterator &) = delete; | ||
UniqueIterator(UniqueIterator &&) noexcept = default; | ||
UniqueIterator &operator=(UniqueIterator &&) = delete; | ||
~UniqueIterator() = default; | ||
|
||
ContainedTy *operator*() const { return Iterator->get(); } | ||
|
||
ContainedTy *operator->() const { return operator*(); } | ||
|
||
UniqueIterator operator++() { | ||
++Iterator; | ||
return *this; | ||
} | ||
|
||
UniqueIterator operator++(int) { | ||
auto Iter(*this); | ||
++*this; | ||
return Iter; | ||
} | ||
|
||
bool operator==(const UniqueIterator &Other) const { | ||
return Iterator == Other.Iterator; | ||
} | ||
|
||
bool operator!=(const UniqueIterator &Other) const { | ||
return !(*this == Other); | ||
} | ||
|
||
private: | ||
IteratorTy Iterator; | ||
}; | ||
|
||
} // namespace vara | ||
|
||
#endif // VARA_UTILS_UNIQUEITERATOR_H |
Oops, something went wrong.