Skip to content

Commit

Permalink
update_c++14_to_c++17_on_windows (#53958)
Browse files Browse the repository at this point in the history
* update_c++14_to_c++17_on_windows

* disable test_audio_logmel_feature and test_audio_mel_feature
  • Loading branch information
risemeup1 authored May 22, 2023
1 parent 5694736 commit 6e04320
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ checkcompilercxx14flag()
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
else()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
endif()

# safe_set_flag
Expand Down
5 changes: 3 additions & 2 deletions paddle/fluid/framework/dlpack_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ static DLDataType GetDLDataTypeFromTypeIndex(proto::VarType::Type type) {
#undef REG_DL_DATA_TYPE
}

struct DLDeviceVisitor
: public std::unary_function<const platform::Place &, ::DLDevice> {
struct DLDeviceVisitor {
using argument_type = const platform::Place &;
using result_type = ::DLDevice;
inline ::DLDevice operator()(const platform::CPUPlace &place) const {
::DLDevice device;
device.device_type = kDLCPU;
Expand Down
12 changes: 9 additions & 3 deletions paddle/fluid/memory/allocation/naive_best_fit_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,9 @@ size_t Used<platform::CustomPlace>(const platform::CustomPlace &place) {
#endif
}

struct AllocVisitor : std::unary_function<const Place, void *> {
struct AllocVisitor {
using argument_type = const Place;
using result_type = void *;
inline explicit AllocVisitor(size_t size) : size_(size) {}

template <typename Place>
Expand All @@ -567,7 +569,9 @@ struct AllocVisitor : std::unary_function<const Place, void *> {
size_t size_;
};

struct FreeVisitor : public std::unary_function<const Place, void> {
struct FreeVisitor {
using argument_type = const Place;
using result_type = void;
inline explicit FreeVisitor(void *ptr, size_t size)
: ptr_(ptr), size_(size) {}

Expand All @@ -581,7 +585,9 @@ struct FreeVisitor : public std::unary_function<const Place, void> {
size_t size_;
};

struct ReleaseVisitor : std::unary_function<const Place, uint64_t> {
struct ReleaseVisitor {
using argument_type = const Place;
using result_type = uint64_t;
template <typename Place>
inline uint64_t operator()(const Place &place) const {
return Release<Place>(place);
Expand Down
4 changes: 3 additions & 1 deletion paddle/fluid/operators/array_to_lod_tensor_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ struct ArrayToLoDFunctorImpl {
void apply();
};

struct ArrayToLoDFunctor : public std::unary_function<platform::Place, void> {
struct ArrayToLoDFunctor {
using argument_type = platform::Place;
using result_type = void;
std::vector<phi::DenseTensor> in;
mutable phi::DenseTensor *out;

Expand Down
5 changes: 3 additions & 2 deletions paddle/fluid/operators/lod_tensor_to_array_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ struct LoDTensorToArrayFunctorImpl {
void apply();
};

struct LoDTensorToArrayFunctor
: public std::unary_function<platform::Place, void> {
struct LoDTensorToArrayFunctor {
using argument_type = platform::Place;
using result_type = void;
std::vector<const phi::DenseTensor *> ref_inputs_;
mutable std::vector<phi::DenseTensor *> outputs_;
const phi::DenseTensor &input_;
Expand Down
5 changes: 3 additions & 2 deletions paddle/phi/kernels/funcs/math_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ void set_constant_with_place<phi::GPUPinnedPlace>(
phi::VisitDataType(tensor->dtype(), TensorSetConstantCPU(tensor, value));
}

struct TensorSetConstantWithPlace
: public std::unary_function<phi::Place, void> {
struct TensorSetConstantWithPlace {
using argument_type = phi::Place;
using result_type = void;
TensorSetConstantWithPlace(const phi::DeviceContext& context,
phi::DenseTensor* tensor,
float value)
Expand Down
12 changes: 8 additions & 4 deletions paddle/utils/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ inline bool equal_pointees(OptionalPointee const& x, OptionalPointee const& y) {
}

template <class OptionalPointee>
struct equal_pointees_t
: std::binary_function<OptionalPointee, OptionalPointee, bool> {
struct equal_pointees_t {
using first_argument_type = OptionalPointee;
using second_argument_type = OptionalPointee;
using result_type = bool;
bool operator()(OptionalPointee const& x, OptionalPointee const& y) const {
return equal_pointees(x, y);
}
Expand All @@ -83,8 +85,10 @@ inline bool less_pointees(OptionalPointee const& x, OptionalPointee const& y) {
}

template <class OptionalPointee>
struct less_pointees_t
: std::binary_function<OptionalPointee, OptionalPointee, bool> {
struct less_pointees_t {
using first_argument_type = OptionalPointee;
using second_argument_type = OptionalPointee;
using result_type = bool;
bool operator()(OptionalPointee const& x, OptionalPointee const& y) const {
return less_pointees(x, y);
}
Expand Down
3 changes: 2 additions & 1 deletion test/legacy_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if(NOT WITH_COVERAGE)
endif()

if(NOT WITH_GPU)
list(REMOVE_ITEM TEST_OPS test_async_read_write)
list(REMOVE_ITEM TEST_OPS test_async_read_write test_audio_logmel_feature
test_audio_mel_feature)
endif()

foreach(src ${TEST_OPS})
Expand Down

0 comments on commit 6e04320

Please sign in to comment.