未验证 提交 96d530c1 编写于 作者: C chentianyu03 提交者: GitHub

move array_ref_test and small_vector_test into paddle/utils and format header macro define (#39831)

上级 95280a36
...@@ -3,5 +3,3 @@ ...@@ -3,5 +3,3 @@
if(WITH_TESTING) if(WITH_TESTING)
cc_library(paddle_gtest_main SRCS paddle_gtest_main.cc DEPS init device_context memory gtest gflags) cc_library(paddle_gtest_main SRCS paddle_gtest_main.cc DEPS init device_context memory gtest gflags)
endif() endif()
cc_test(small_vector_test SRCS small_vector_test.cc DEPS gtest gflags)
cc_test(array_ref_test SRCS array_ref_test.cc DEPS gtest gflags)
add_subdirectory(string) add_subdirectory(string)
cc_test(small_vector_test SRCS small_vector_test.cc DEPS gtest gflags)
cc_test(array_ref_test SRCS array_ref_test.cc DEPS gtest gflags)
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
// See http://www.boost.org/libs/any for Documentation. // See http://www.boost.org/libs/any for Documentation.
#ifndef PADDLE_ANY_INCLUDED #pragma once
#define PADDLE_ANY_INCLUDED
// what: variant type boost::any // what: variant type boost::any
// who: contributed by Kevlin Henney, // who: contributed by Kevlin Henney,
...@@ -168,12 +167,10 @@ template <typename ValueType> ...@@ -168,12 +167,10 @@ template <typename ValueType>
inline const ValueType *unsafe_any_cast(const any *operand) { inline const ValueType *unsafe_any_cast(const any *operand) {
return unsafe_any_cast<ValueType>(const_cast<any *>(operand)); return unsafe_any_cast<ValueType>(const_cast<any *>(operand));
} }
} } // namespace paddle
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved. // Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#endif
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef PADDLE_UTILS_ARRAY_REF_H_ #pragma once
#define PADDLE_UTILS_ARRAY_REF_H_
#include <algorithm> #include <algorithm>
#include <array> #include <array>
...@@ -332,6 +331,4 @@ inline bool operator!=(SmallVectorImpl<T> &LHS, ArrayRef<T> RHS) { ...@@ -332,6 +331,4 @@ inline bool operator!=(SmallVectorImpl<T> &LHS, ArrayRef<T> RHS) {
return !(LHS == RHS); return !(LHS == RHS);
} }
} // end namespace paddle } // namespace paddle
#endif // PADDLE_UTILS_ARRAY_REF_H_
...@@ -1741,4 +1741,4 @@ struct power_of_two_std_hash : std::hash<T> { ...@@ -1741,4 +1741,4 @@ struct power_of_two_std_hash : std::hash<T> {
typedef paddle::power_of_two_hash_policy hash_policy; typedef paddle::power_of_two_hash_policy hash_policy;
}; };
} // end namespace paddle } // namespace paddle
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
// You are welcome to contact the author at: // You are welcome to contact the author at:
// fernando_cacciola@hotmail.com // fernando_cacciola@hotmail.com
// //
#ifndef PADDLE_NONE_17SEP2003_HPP #pragma once
#define PADDLE_NONE_17SEP2003_HPP
namespace paddle { namespace paddle {
...@@ -26,7 +25,7 @@ struct none_helper {}; ...@@ -26,7 +25,7 @@ struct none_helper {};
typedef int detail::none_helper::*none_t; typedef int detail::none_helper::*none_t;
} // namespace boost } // namespace paddle
// NOTE: Borland users have to include this header outside any precompiled // NOTE: Borland users have to include this header outside any precompiled
// headers // headers
...@@ -37,6 +36,4 @@ namespace paddle { ...@@ -37,6 +36,4 @@ namespace paddle {
none_t const none = ((none_t)0); none_t const none = ((none_t)0);
} // namespace boost } // namespace paddle
#endif
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
// You are welcome to contact the author at: // You are welcome to contact the author at:
// fernando_cacciola@hotmail.com // fernando_cacciola@hotmail.com
// //
#ifndef PADDLE_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP #pragma once
#define PADDLE_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
...@@ -27,6 +26,8 @@ ...@@ -27,6 +26,8 @@
#include "none.h" #include "none.h"
namespace paddle {
// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> // Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<>
// member template of a factory as used in the optional<> implementation. // member template of a factory as used in the optional<> implementation.
// He proposed this simple fix which is to move the call to apply<> outside // He proposed this simple fix which is to move the call to apply<> outside
...@@ -38,7 +39,6 @@ void construct(Factory const& factory, void* address) { ...@@ -38,7 +39,6 @@ void construct(Factory const& factory, void* address) {
} }
} }
namespace paddle {
template <typename T> template <typename T>
class optional; class optional;
...@@ -865,5 +865,3 @@ inline void optional_swap(optional<T>& x, optional<T>& y) { ...@@ -865,5 +865,3 @@ inline void optional_swap(optional<T>& x, optional<T>& y) {
} // namespace optional_detail } // namespace optional_detail
} // namespace paddle } // namespace paddle
#endif
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef PADDLE_UTILS_SMALL_VECTOR_H_ #pragma once
#define PADDLE_UTILS_SMALL_VECTOR_H_
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
...@@ -1461,7 +1460,7 @@ static_assert(sizeof(SmallVectorSizeType<char>) == sizeof(uint32_t), ...@@ -1461,7 +1460,7 @@ static_assert(sizeof(SmallVectorSizeType<char>) == sizeof(uint32_t),
"Expected SmallVectorBase<uint32_t> variant to be in use."); "Expected SmallVectorBase<uint32_t> variant to be in use.");
#endif #endif
} // end namespace paddle } // namespace paddle
namespace std { namespace std {
...@@ -1479,6 +1478,4 @@ inline void swap(paddle::SmallVector<T, N> &LHS, ...@@ -1479,6 +1478,4 @@ inline void swap(paddle::SmallVector<T, N> &LHS,
LHS.swap(RHS); LHS.swap(RHS);
} }
} // end namespace std } // namespace std
#endif // PADDLE_UTILS_SMALL_VECTOR_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册