Skip to content

Commit

Permalink
Resolve issues with scoped enums (#244)
Browse files Browse the repository at this point in the history
* enum test

* fix
  • Loading branch information
eendebakpt authored Oct 4, 2023
1 parent 5effc99 commit 9a81ccb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def run_tests(self):
swig_opts += ["-Isrc/nauty/"]
compile_options += ["-Isrc/nauty/"]

# specifically for clang
# compile_options += ["-std=c++11"]


if platform.system() == "Windows":
compile_options += ["-DWIN32", "-D_WIN32"]
Expand Down Expand Up @@ -384,7 +387,7 @@ def readme():
data_files=data_files,
scripts=scripts,
tests_require=[
"numpy>=1.22",
"numpy>=1.24",
"nose",
"coverage",
"matplotlib",
Expand All @@ -393,7 +396,7 @@ def readme():
"types-python-dateutil",
],
zip_safe=False,
install_requires=["numpy>=1.22", "python-dateutil", "matplotlib"],
install_requires=["numpy>=1.24", "python-dateutil", "matplotlib"],
extras_require={
"doc": ["sphinx", "sphinxcontrib.bibtex", "sphinxcontrib.napoleon", "breathe"],
},
Expand Down
2 changes: 1 addition & 1 deletion src/arrayproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mvalue_t< long > A3A4 (const array_link &al) {
w.push_back (w3);
w.push_back (w4);

mvalue_t< long > wm (w, direction_t::LOW);
mvalue_t< long > wm (w, LOW);
return wm;
}

Expand Down
2 changes: 1 addition & 1 deletion src/arrayproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ inline mvalue_t< long > F4 (const array_link &al, int verbose = 1) {
myprintf ("\n");
}

mvalue_t< long > v (FF, direction_t::LOW);
mvalue_t< long > v (FF, LOW);
return v;
}

Expand Down
24 changes: 12 additions & 12 deletions src/mathtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ class larray {
}
};

enum direction_t {
/// Order from high to low values
HIGH,
/// Order from low to high values
LOW
};
/// Order from high to low values
const int HIGH = 0;
/// Order from low to high values
const int LOW = 1;
typedef int direction_t;


/** @brief Multi-value type
*
Expand All @@ -264,15 +264,15 @@ struct mvalue_t {
*
* The object consists of a vector of elements.
*/
mvalue_t () : ordering (direction_t::HIGH){};
mvalue_t () : ordering (HIGH){};
~mvalue_t (){};

/** @copydoc mvalue_t::mvalue_t()
*
* \param element Single element to add to the vector
* \param dd Ordering to use
*/
mvalue_t (NumericType element, direction_t dd = direction_t::HIGH) {
mvalue_t (NumericType element, direction_t dd = HIGH) {
values.push_back (element);
ordering = dd;
}
Expand All @@ -281,7 +281,7 @@ struct mvalue_t {
* \param elements Vector to use for initalization of the object
* \param dd Ordering to use
*/
mvalue_t (std::vector< NumericType > elements, direction_t dd = direction_t::HIGH) {
mvalue_t (std::vector< NumericType > elements, direction_t dd = HIGH) {
ordering = dd;
this->values = elements;
}
Expand All @@ -291,7 +291,7 @@ struct mvalue_t {
* \param elements Vector to use for initalization of the object
* \param dd Ordering to use
*/
template < class T > mvalue_t(std::vector< T > elements, direction_t dd = direction_t::HIGH) {
template < class T > mvalue_t(std::vector< T > elements, direction_t dd = HIGH) {
ordering = dd;
values.clear();
values.resize(elements.size());
Expand Down Expand Up @@ -339,15 +339,15 @@ struct mvalue_t {

bool operator< (const mvalue_t &rhs) const {
bool val = 0;
if (ordering ==direction_t::HIGH)
if (ordering == HIGH)
val = (bool)worse (rhs);
else
val = (bool)better (rhs);
return val;
}
bool operator> (const mvalue_t &rhs) const {
bool val = 0;
if (ordering == direction_t::HIGH)
if (ordering == HIGH)
val = (bool)better (rhs);
else
val = (bool)worse (rhs);
Expand Down

0 comments on commit 9a81ccb

Please sign in to comment.