Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace CMath::swap with std::swap #4187

Merged
merged 3 commits into from
Apr 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/shogun/base/DynArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ template <class T> class DynArray
*/
inline int32_t set_granularity(int32_t g)
{
g=CMath::max(g,1);
g = std::max(g, 1);
this->resize_granularity = g;
return g;
}
Expand Down Expand Up @@ -445,14 +445,18 @@ template <class T> class DynArray
void shuffle()
{
for (index_t i=0; i<=current_num_elements-1; ++i)
CMath::swap(array[i], array[CMath::random(i, current_num_elements-1)]);
std::swap(
array[i],
array[CMath::random(i, current_num_elements - 1)]);
}

/** randomizes the array with external random state */
void shuffle(CRandom * rand)
{
for (index_t i=0; i<=current_num_elements-1; ++i)
CMath::swap(array[i], array[rand->random(i, current_num_elements-1)]);
std::swap(
array[i],
array[rand->random(i, current_num_elements - 1)]);
}

/** set array with a constant */
Expand Down