Skip to content

Commit 37288ae

Browse files
committed
Made constructors of IntSet explicit
1 parent e74f89c commit 37288ae

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

changelog.in

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ New stuff!
7070

7171
[ENTRY]
7272
Module: int
73-
What: removed
73+
What: changed
7474
Rank: minor
7575
Thanks: Jens Krueger
7676
[DESCRIPTION]
77-
The bool test operator has been removed from IntSet (it created
78-
problems and is actually useless for IntSet as they are always
79-
initialized).
77+
All constructors and the bool test operator of IntSet have been
78+
made explicit to avoid unintended behavior.
8079

8180
[ENTRY]
8281
Module: other

gecode/int.hh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ namespace Gecode {
208208
/// Initialize with \a n ranges from array \a r
209209
GECODE_INT_EXPORT void init(const int r[][2], int n);
210210
public:
211-
/// Remove initialization test
212-
operator bool(void) const = delete;
213211
/// \name Constructors and initialization
214212
//@{
215213
/// Initialize as empty set
@@ -218,15 +216,15 @@ namespace Gecode {
218216
*
219217
* Note that the set is empty if \a n is larger than \a m
220218
*/
221-
IntSet(int n, int m);
219+
explicit IntSet(int n, int m);
222220
/// Initialize with \a n integers from array \a r
223-
IntSet(const int r[], int n);
221+
explicit IntSet(const int r[], int n);
224222
/** \brief Initialize with \a n ranges from array \a r
225223
*
226224
* For position \a i in the array \a r, the minimum is \a r[\a i][0]
227225
* and the maximum is \a r[\a i][1].
228226
*/
229-
IntSet(const int r[][2], int n);
227+
explicit IntSet(const int r[][2], int n);
230228
/// Initialize with range iterator \a i
231229
template<class I>
232230
explicit IntSet(I& i);
@@ -235,14 +233,14 @@ namespace Gecode {
235233
explicit IntSet(const I& i);
236234
/// Initialize with integers from list \a r
237235
GECODE_INT_EXPORT
238-
IntSet(std::initializer_list<int> r);
236+
explicit IntSet(std::initializer_list<int> r);
239237
/** \brief Initialize with ranges from vector \a r
240238
*
241239
* The minimum is the first element and the maximum is the
242240
* second element.
243241
*/
244242
GECODE_INT_EXPORT
245-
IntSet(std::initializer_list<std::pair<int,int>> r);
243+
explicit IntSet(std::initializer_list<std::pair<int,int>> r);
246244
//@}
247245

248246
/// \name Range access

0 commit comments

Comments
 (0)