Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:28:09

0001 // Tencent is pleased to support the open source community by making RapidJSON available.
0002 //
0003 // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
0004 //
0005 // Licensed under the MIT License (the "License"); you may not use this file except
0006 // in compliance with the License. You may obtain a copy of the License at
0007 //
0008 // http://opensource.org/licenses/MIT
0009 //
0010 // Unless required by applicable law or agreed to in writing, software distributed
0011 // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
0012 // CONDITIONS OF ANY KIND, either express or implied. See the License for the
0013 // specific language governing permissions and limitations under the License.
0014 
0015 #ifndef RAPIDJSON_INTERNAL_SWAP_H_
0016 #define RAPIDJSON_INTERNAL_SWAP_H_
0017 
0018 #include "../rapidjson.h"
0019 
0020 #if defined(__clang__)
0021 RAPIDJSON_DIAG_PUSH
0022 RAPIDJSON_DIAG_OFF(c++98-compat)
0023 #endif
0024 
0025 RAPIDJSON_NAMESPACE_BEGIN
0026 namespace internal {
0027 
0028 //! Custom swap() to avoid dependency on C++ <algorithm> header
0029 /*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only.
0030     \note This has the same semantics as std::swap().
0031 */
0032 template <typename T>
0033 inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT {
0034     T tmp = a;
0035         a = b;
0036         b = tmp;
0037 }
0038 
0039 } // namespace internal
0040 RAPIDJSON_NAMESPACE_END
0041 
0042 #if defined(__clang__)
0043 RAPIDJSON_DIAG_POP
0044 #endif
0045 
0046 #endif // RAPIDJSON_INTERNAL_SWAP_H_