TheAlgorithms / C-Plus-Plus

Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
https://thealgorithms.github.io/C-Plus-Plus
MIT License
30.67k stars 7.27k forks source link

fix: fix deprecation warning for macOS #2711

Closed MaximSmolskiy closed 2 months ago

MaximSmolskiy commented 2 months ago

Description of Change

Fix deprecation warning for macOS:

[ 48%] Building CXX object sorting/CMakeFiles/bogo_sort.dir/bogo_sort.cpp.o
/Users/runner/work/C-Plus-Plus/C-Plus-Plus/sorting/bogo_sort.cpp:54:14: warning: 'random_shuffle<int *>' is deprecated [-Wdeprecated-declarations]
        std::random_shuffle(arr.begin(), arr.end());// Shuffle the array
             ^
/Users/runner/work/C-Plus-Plus/C-Plus-Plus/sorting/bogo_sort.cpp:86:21: note: in instantiation of function template specialization 'sorting::randomized_bogosort<int, 5UL>' requested here
    arr1 = sorting::randomized_bogosort(arr1);
                    ^
/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/shuffle.h:96:23: note: 'random_shuffle<int *>' has been explicitly marked deprecated here
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
                      ^
/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__config:1031:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX14'
#    define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
                                        ^
/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__config:1010:49: note: expanded from macro '_LIBCPP_DEPRECATED'
#      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
                                                ^
1 warning generated.

Checklist

Notes:

MaximSmolskiy commented 2 months ago

@Panquesito7 @realstealthninja please review