diff --git a/Package.resolved b/Package.resolved deleted file mode 100644 index 7c685f95..00000000 --- a/Package.resolved +++ /dev/null @@ -1,33 +0,0 @@ -{ - "originHash" : "912604f76e421a385106670da68e757144a557379bcf9e006b45eb9bfe533a92", - "pins" : [ - { - "identity" : "metaversepythonframework", - "kind" : "remoteSourceControl", - "location" : "https://github.com/wabiverse/MetaversePythonFramework", - "state" : { - "revision" : "e2f4ba867b7e287a283a27a0005ab64deef14279", - "version" : "3.11.7" - } - }, - { - "identity" : "metaversevulkanframework", - "kind" : "remoteSourceControl", - "location" : "https://github.com/wabiverse/MetaverseVulkanFramework", - "state" : { - "revision" : "13c7061599c61a4959c558d8ec1836e5b32b640b", - "version" : "1.26.2" - } - }, - { - "identity" : "pythonkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pvieito/PythonKit.git", - "state" : { - "revision" : "43647b36cacb99558e57ef98e97ef598f91d1164", - "version" : "0.5.0" - } - } - ], - "version" : 3 -} diff --git a/Package.swift b/Package.swift index d64e4612..227814e3 100644 --- a/Package.swift +++ b/Package.swift @@ -41,7 +41,6 @@ let package = Package( dependencies: [ .target(name: "OneTBB"), ], - publicHeadersPath: ".", cxxSettings: [ .define("_XOPEN_SOURCE", to: "1", .when(platforms: Arch.OS.apple.platform)), .define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])), @@ -55,9 +54,8 @@ let package = Package( .target(name: "OneTBB"), .target(name: "TBBMallocProxy"), ], - exclude: [], - publicHeadersPath: ".", cxxSettings: [ + .headerSearchPath("include/TBBMalloc"), .define("_XOPEN_SOURCE", to: "1", .when(platforms: Arch.OS.apple.platform)), .define("__TBBMALLOC_BUILD", to: "1"), .define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])), @@ -67,7 +65,9 @@ let package = Package( .target( name: "OneTBB", - publicHeadersPath: "include", + dependencies: [ + .target(name: "MicrosoftSTL", condition: .when(platforms: Arch.OS.windows.platform)), + ], cxxSettings: [ .define("_XOPEN_SOURCE", to: "1", .when(platforms: Arch.OS.apple.platform)), .define("TBB_ALLOCATOR_TRAITS_BROKEN", to: "1", .when(platforms: Arch.OS.linux.platform)), @@ -263,9 +263,13 @@ let package = Package( ] ), + .target(name: "Apple"), + .target( - name: "Apple", - publicHeadersPath: "include" + name: "MicrosoftSTL", + cxxSettings: [ + .define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])), + ] ), .target( @@ -524,6 +528,7 @@ let package = Package( .target(name: "Imath"), .target(name: "OpenEXR"), .target(name: "PyBind11", condition: .when(platforms: Arch.OS.nixnodroid.platform)), + .target(name: "MicrosoftSTL", condition: .when(platforms: Arch.OS.windows.platform)), ], exclude: getConfig(for: .oiio).exclude, publicHeadersPath: "include", @@ -618,7 +623,8 @@ let package = Package( publicHeadersPath: "include", cxxSettings: [ .define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])), - .define("PTEX_EXPORTS", .when(platforms: [.windows])) + .define("PTEX_EXPORTS", .when(platforms: [.windows])), + .define("PTEX_PLATFORM_WINDOWS", .when(platforms: [.windows])), ] ), @@ -697,6 +703,7 @@ let package = Package( .target(name: "Imath"), .target(name: "OpenEXR"), .target(name: "ZLibDataCompression"), + .target(name: "any"), Arch.OS.python(), Arch.OS.boost() ], @@ -1240,6 +1247,10 @@ func getConfig(for target: PkgTarget) -> TargetInfo name: "Apple", targets: ["Apple"] ), + .library( + name: "MicrosoftSTL", + targets: ["MicrosoftSTL"] + ), .library( name: "DEFLATE", targets: ["DEFLATE"] @@ -1591,9 +1602,15 @@ enum Arch { #if os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS) .product(name: "Python", package: "MetaversePythonFramework", condition: .when(platforms: Arch.OS.apple.platform)) - #elseif os(Windows) || os(Cygwin) || os(WASI) || os(Android) - // python is disabled on Windows, Cygwin, and WASI - // just return ZStandard for fast package resolution, + #elseif os(Windows) || os(Cygwin) + // python is disabled on both Windows, Cygwin here + // just return the STL for fast package resolution, + // things get very slow to resolve if this is optional + // or if we try to add arrays together. + .target(name: "MicrosoftSTL") + #elseif os(WASI) + // python is disabled on WebAssembly, for now just + // just return the Zstd for fast package resolution, // things get very slow to resolve if this is optional // or if we try to add arrays together. .target(name: "ZStandard") diff --git a/Sources/MetaversalDemo/Creator.swift b/Sources/MetaversalDemo/Creator.swift index 822deda1..d63b164f 100644 --- a/Sources/MetaversalDemo/Creator.swift +++ b/Sources/MetaversalDemo/Creator.swift @@ -39,16 +39,8 @@ import OpenImageIO import OpenSubdiv import OpenTime import OpenTimelineIO -#if os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS) - // windows doesn't like the - // mismatched std.version - // coming in from TBB from - // the OpenVDB import. - import OpenVDB -#endif // os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS) -#if !os(Windows) - import Ptex -#endif // !os(Windows) +import OpenVDB +import Ptex #if canImport(Python) && (os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS)) import PyBundle import Python diff --git a/Sources/MicrosoftSTL/MicrosoftSTL.cpp b/Sources/MicrosoftSTL/MicrosoftSTL.cpp new file mode 100644 index 00000000..460710ba --- /dev/null +++ b/Sources/MicrosoftSTL/MicrosoftSTL.cpp @@ -0,0 +1,3 @@ +#include + +int __wabi_microsoftStl__; diff --git a/Sources/MicrosoftSTL/include/MicrosoftSTL/MicrosoftSTL.h b/Sources/MicrosoftSTL/include/MicrosoftSTL/MicrosoftSTL.h new file mode 100644 index 00000000..189cea4b --- /dev/null +++ b/Sources/MicrosoftSTL/include/MicrosoftSTL/MicrosoftSTL.h @@ -0,0 +1,16 @@ +#ifndef __WABI_MICROSOFT_STL_H__ +#define __WABI_MICROSOFT_STL_H__ + +#if defined(_WIN32) +// otherwise, MicrosoftSTL completely fails when +// we are using anything below C++20, and that's +// just rediculous, specifically for the include +// of the STL's header anywhere within +// MetaverseKit due to a modulemap requiring the +// C++20 language standard for that header, this +// workaround replaces every: #include +// with: #include +# include +#endif // defined(_WIN32) + +#endif // __WABI_MICROSOFT_STL_H__ diff --git a/Sources/MicrosoftSTL/include/MicrosoftSTL/STLVersion.h b/Sources/MicrosoftSTL/include/MicrosoftSTL/STLVersion.h new file mode 100644 index 00000000..2112e4e6 --- /dev/null +++ b/Sources/MicrosoftSTL/include/MicrosoftSTL/STLVersion.h @@ -0,0 +1,2039 @@ +// yvals_core.h internal header (core) + +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#ifndef _YVALS_CORE_H_ +#define _YVALS_CORE_H_ +#if defined(_WIN32) + +#ifndef _STL_COMPILER_PREPROCESSOR +// All STL headers avoid exposing their contents when included by various +// non-C++-compiler tools to avoid breaking builds when we use newer language +// features in the headers than such tools understand. +#if defined(RC_INVOKED) || defined(Q_MOC_RUN) || defined(__midl) +#define _STL_COMPILER_PREPROCESSOR 0 +#else +#define _STL_COMPILER_PREPROCESSOR 1 +#endif +#endif // !defined(_STL_COMPILER_PREPROCESSOR) + +#if _STL_COMPILER_PREPROCESSOR + +// This does not use `_EMIT_STL_ERROR`, as it is checking the language itself. +#ifndef __cplusplus +#error error STL1003: Unexpected compiler, expected C++ compiler. +#endif // !defined(__cplusplus) + +// Implemented unconditionally: +// N3911 void_t +// N4089 Safe Conversions In unique_ptr +// N4169 invoke() +// N4258 noexcept Cleanups +// N4259 uncaught_exceptions() +// N4277 Trivially Copyable reference_wrapper +// N4279 insert_or_assign()/try_emplace() For map/unordered_map +// N4280 size(), empty(), data() +// N4366 Precisely Constraining unique_ptr Assignment +// N4387 Improving pair And tuple +// N4389 bool_constant +// N4508 shared_mutex (Untimed) +// N4510 Supporting Incomplete Types In vector/list/forward_list +// P0006R0 Variable Templates For Type Traits (is_same_v, etc.) +// P0007R1 as_const() +// P0013R1 Logical Operator Type Traits (conjunction, etc.) +// P0033R1 Rewording enable_shared_from_this +// P0063R3 C11 Standard Library +// P0074R0 owner_less<> +// P0092R1 floor(), ceil(), round(), abs() +// P0340R3 SFINAE-Friendly underlying_type +// P0414R2 shared_ptr, shared_ptr +// P0418R2 atomic compare_exchange memory_order Requirements +// P0435R1 Overhauling common_type +// P0497R0 Fixing shared_ptr For Arrays +// P0513R0 Poisoning hash +// P0516R0 Marking shared_future Copying As noexcept +// P0517R0 Constructing future_error From future_errc +// P0548R1 Tweaking common_type And duration +// P0558R1 Resolving atomic Named Base Class Inconsistencies +// P0599R1 noexcept hash +// P0738R2 istream_iterator Cleanup +// P0771R1 noexcept For std::function's Move Constructor +// P0777R1 Avoiding Unnecessary decay +// P0809R0 Comparing Unordered Containers +// P0883R2 Fixing Atomic Initialization +// P0935R0 Eradicating Unnecessarily Explicit Default Constructors +// P0941R2 Feature-Test Macros +// P0972R0 noexcept For zero(), min(), max() +// P1065R2 constexpr INVOKE +// (the std::invoke function only; other components like bind and reference_wrapper are C++20 only) +// P1164R1 Making create_directory() Intuitive +// P1165R1 Consistently Propagating Stateful Allocators In basic_string's operator+() +// P1902R1 Missing Feature-Test Macros 2017-2019 +// P2013R5 Freestanding Language: Optional ::operator new +// (no change is needed for our hosted implementation) +// P2198R7 Freestanding Feature-Test Macros And Implementation-Defined Extensions +// (except for __cpp_lib_freestanding_ranges) +// P2338R4 Freestanding Library: Character Primitives And The C Library +// (except for __cpp_lib_freestanding_charconv) +// P2401R0 Conditional noexcept For exchange() +// P2937R0 Freestanding Library: Remove strtok + +// _HAS_CXX17 directly controls: +// P0005R4 not_fn() +// P0024R2 Parallel Algorithms +// P0025R1 clamp() +// P0030R1 hypot(x, y, z) +// P0031R0 constexpr For (Again) And +// P0032R3 Homogeneous Interface For variant/any/optional +// P0040R3 Extending Memory Management Tools +// P0067R5 Elementary String Conversions +// P0083R3 Splicing Maps And Sets +// P0084R2 Emplace Return Type +// P0088R3 +// P0137R1 launder() +// P0152R1 atomic::is_always_lock_free +// P0154R1 hardware_destructive_interference_size, etc. +// P0156R2 scoped_lock +// P0163R0 shared_ptr::weak_type +// P0185R1 is_swappable, is_nothrow_swappable +// P0209R2 make_from_tuple() +// P0218R1 +// P0220R1 , , , , apply(), sample(), Boyer-Moore search() +// P0226R1 Mathematical Special Functions +// P0253R1 Fixing Searcher Return Types +// P0254R2 Integrating string_view And std::string +// P0258R2 has_unique_object_representations +// P0272R1 Non-const basic_string::data() +// P0295R0 gcd(), lcm() +// P0307R2 Making Optional Greater Equal Again +// P0336R1 Renaming Parallel Execution Policies +// P0337R0 Deleting polymorphic_allocator Assignment +// P0358R1 Fixes For not_fn() +// P0393R3 Making Variant Greater Equal +// P0394R4 Parallel Algorithms Should terminate() For Exceptions +// P0403R1 UDLs For ("meow"sv, etc.) +// P0426R1 constexpr For char_traits +// P0433R2 Deduction Guides For The STL +// P0452R1 Unifying Parallel Algorithms +// P0504R0 Revisiting in_place_t/in_place_type_t/in_place_index_t +// P0505R0 constexpr For (Again) +// P0508R0 Clarifying insert_return_type +// P0510R0 Rejecting variants Of Nothing, Arrays, References, And Incomplete Types +// P0602R4 Propagating Copy/Move Triviality In variant/optional +// P0604R0 invoke_result, is_invocable, is_nothrow_invocable +// P0607R0 Inline Variables For The STL +// P0682R1 Repairing Elementary String Conversions +// P0739R0 Improving Class Template Argument Deduction For The STL +// P0858R0 Constexpr Iterator Requirements +// P1169R4 static operator() +// P1518R2 Stop Overconstraining Allocators In Container Deduction Guides +// P2162R2 Inheriting From variant +// P2251R1 Require span And basic_string_view To Be Trivially Copyable +// (basic_string_view always provides this behavior) +// P2338R4 Freestanding Library: Character Primitives And The C Library +// (including __cpp_lib_freestanding_charconv) +// P2517R1 Conditional noexcept For apply() + +// _HAS_CXX17 indirectly controls: +// N4190 Removing auto_ptr, random_shuffle(), And Old Stuff +// P0003R5 Removing Dynamic Exception Specifications +// P0004R1 Removing Deprecated Iostreams Aliases +// P0298R3 std::byte +// P0302R1 Removing Allocator Support In std::function +// LWG-2385 function::assign allocator argument doesn't make sense +// LWG-2921 packaged_task and type-erased allocators +// LWG-2976 Dangling uses_allocator specialization for packaged_task +// The non-Standard std::tr1 namespace and TR1-only machinery +// Enforcement of matching allocator value_types + +// _HAS_CXX17 and _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS control: +// P0174R2 Deprecating Vestigial Library Parts +// P0521R0 Deprecating shared_ptr::unique() +// P0618R0 Deprecating +// Other C++17 deprecation warnings + +// Implemented when char8_t is available (C++14/17 with /Zc:char8_t, C++20 without /Zc:char8_t-): +// P0482R6 Library Support For char8_t +// (mbrtoc8 and c8rtomb not yet implemented, see GH-2207) + +// _HAS_CXX20 directly controls: +// P0019R8 atomic_ref +// P0020R6 atomic, atomic, atomic +// P0053R7 +// P0122R7 +// P0202R3 constexpr For And exchange() +// P0318R1 unwrap_reference, unwrap_ref_decay +// P0325R4 to_array() +// P0339R6 polymorphic_allocator<> +// P0355R7 Calendars And Time Zones +// P0356R5 bind_front() +// P0357R3 Supporting Incomplete Types In reference_wrapper +// P0408R7 Efficient Access To basic_stringbuf's Buffer +// P0415R1 constexpr For (Again) +// P0439R0 enum class memory_order +// P0457R2 starts_with()/ends_with() For basic_string/basic_string_view +// P0458R2 contains() For Ordered And Unordered Associative Containers +// P0463R1 endian +// P0466R5 Layout-Compatibility And Pointer-Interconvertibility Traits +// P0475R1 Guaranteed Copy Elision For Piecewise Construction +// P0476R2 bit_cast +// P0487R1 Fixing operator>>(basic_istream&, CharT*) +// P0528R3 Atomic Compare-And-Exchange With Padding Bits +// P0550R2 remove_cvref +// P0553R4 Rotating And Counting Functions +// P0556R3 Integral Power-Of-2 Operations (renamed by P1956R1) +// P0586R2 Integer Comparison Functions +// P0591R4 Utility Functions For Uses-Allocator Construction +// P0595R2 is_constant_evaluated() +// P0608R3 Improving variant's Converting Constructor/Assignment +// P0616R0 Using move() In +// P0631R8 Math Constants +// P0645R10 Text Formatting +// P0646R1 list/forward_list remove()/remove_if()/unique() Return size_type +// P0653R2 to_address() +// P0655R1 visit() +// P0660R10 And jthread +// P0674R1 make_shared() For Arrays +// P0718R2 atomic>, atomic> +// P0753R2 osyncstream Manipulators +// P0758R1 is_nothrow_convertible +// P0768R1 Library Support For The Spaceship Comparison Operator <=> +// P0769R2 shift_left(), shift_right() +// P0784R7 Library Support For More constexpr Containers +// P0811R3 midpoint(), lerp() +// P0849R8 auto(x): decay-copy In The Language +// (library part only) +// P0879R0 constexpr For Swapping Functions +// P0887R1 type_identity +// P0896R4 Ranges +// P0898R3 Standard Library Concepts +// P0912R5 Library Support For Coroutines +// P0919R3 Heterogeneous Lookup For Unordered Containers +// P0966R1 string::reserve() Should Not Shrink +// P0980R1 constexpr std::string +// P1001R2 execution::unseq +// P1004R2 constexpr std::vector +// P1006R1 constexpr For pointer_traits::pointer_to() +// P1007R3 assume_aligned() +// P1020R1 Smart Pointer Creation With Default Initialization +// P1023R0 constexpr For std::array Comparisons +// P1024R3 Enhancing span Usability +// P1032R1 Miscellaneous constexpr +// P1035R7 Input Range Adaptors +// P1065R2 constexpr INVOKE +// (except the std::invoke function which is implemented unconditionally) +// P1085R2 Removing span Comparisons +// P1115R3 erase()/erase_if() Return size_type +// P1123R0 Atomic Compare-And-Exchange With Padding Bits For atomic_ref +// P1135R6 The C++20 Synchronization Library +// P1207R4 Movability Of Single-Pass Iterators +// P1208R6 +// P1209R0 erase_if(), erase() +// P1227R2 Signed std::ssize(), Unsigned span::size() +// P1243R4 Rangify New Algorithms +// P1248R1 Fixing Relations +// P1252R2 Ranges Design Cleanup +// P1357R1 is_bounded_array, is_unbounded_array +// P1391R4 Range Constructor For string_view +// P1394R4 Range Constructor For span +// P1423R3 char8_t Backward Compatibility Remediation +// P1456R1 Move-Only Views +// P1474R1 Helpful Pointers For contiguous_iterator +// P1522R1 Iterator Difference Type And Integer Overflow +// P1523R1 Views And Size Types +// P1612R1 Relocating endian To +// P1614R2 Adding Spaceship <=> To The Library +// P1638R1 basic_istream_view::iterator Should Not Be Copyable +// P1645R1 constexpr For Algorithms +// P1651R0 bind_front() Should Not Unwrap reference_wrapper +// P1690R1 Refining Heterogeneous Lookup For Unordered Containers +// P1716R3 Range Comparison Algorithms Are Over-Constrained +// P1739R4 Avoiding Template Bloat For Ranges +// P1754R1 Rename Concepts To standard_case +// P1862R1 Range Adaptors For Non-Copyable Iterators +// P1865R1 Adding max() To latch And barrier +// P1870R1 Rename forwarding-range To borrowed_range (Was safe_range before LWG-3379) +// P1871R1 disable_sized_sentinel_for +// P1872R0 span Should Have size_type, Not index_type +// P1878R1 Constraining Readable Types +// P1907R2 ranges::ssize +// P1956R1 has_single_bit(), bit_ceil(), bit_floor(), bit_width() +// P1959R0 Removing weak_equality And strong_equality +// P1960R0 atomic_ref Cleanup +// P1964R2 Replacing boolean With boolean-testable +// P1973R1 Renaming default_init To for_overwrite +// P1976R2 Explicit Constructors For Fixed-Extent span From Dynamic-Extent Ranges +// P1983R0 Fixing Minor Ranges Issues +// P1994R1 elements_view Needs Its Own sentinel +// P2017R1 Conditionally Borrowed Ranges +// P2091R0 Fixing Issues With Range Access CPOs +// P2102R0 Making "Implicit Expression Variations" More Explicit +// P2106R0 Range Algorithm Result Types +// P2116R0 Removing tuple-Like Protocol Support From Fixed-Extent span +// P2167R3 Improving boolean-testable Usage +// P2198R7 Freestanding Feature-Test Macros And Implementation-Defined Extensions +// (including __cpp_lib_freestanding_ranges) +// P2210R2 Superior String Splitting +// P2216R3 std::format Improvements +// P2231R1 Completing constexpr In optional And variant +// P2251R1 Require span And basic_string_view To Be Trivially Copyable +// (span always provides this behavior) +// P2259R1 Repairing Input Range Adaptors And counted_iterator +// P2281R1 Clarifying Range Adaptor Objects +// P2325R3 Views Should Not Be Required To Be Default Constructible +// P2328R1 join_view Should Join All views Of ranges +// P2367R0 Remove Misuses Of List-Initialization From Clause 24 Ranges +// P2372R3 Fixing Locale Handling In chrono Formatters +// P2393R1 Cleaning Up Integer-Class Types +// P2408R5 Ranges Iterators As Inputs To Non-Ranges Algorithms +// P2415R2 What Is A view? +// P2418R2 Add Support For std::generator-like Types To std::format +// P2419R2 Clarify Handling Of Encodings In Localized Formatting Of chrono Types +// P2432R1 Fix istream_view +// P2465R3 Standard Library Modules std And std.compat +// P2508R1 basic_format_string, format_string, wformat_string +// P2510R3 Formatting Pointers +// P2520R0 move_iterator Should Be A Random-Access Iterator +// P2538R1 ADL-Proof projected +// P2572R1 std::format Fill Character Allowances +// P2588R3 barrier's Phase Completion Guarantees +// P2602R2 Poison Pills Are Too Toxic +// P2609R3 Relaxing Ranges Just A Smidge +// P2655R3 common_reference_t Of reference_wrapper Should Be A Reference Type +// P2675R1 Improving std::format's Width Estimation +// P2711R1 Making Multi-Param Constructors Of Views explicit +// P2736R2 Referencing The Unicode Standard +// P2770R0 Stashing Stashing Iterators For Proper Flattening +// P2905R2 Runtime Format Strings +// P2909R4 Fix Formatting Of Code Units As Integers + +// _HAS_CXX20 indirectly controls: +// P0619R4 Removing C++17-Deprecated Features + +// _HAS_CXX20 and _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS control: +// P0767R1 Deprecating is_pod +// P1831R1 Deprecating volatile In The Standard Library +// Other C++20 deprecation warnings + +// _HAS_CXX23 directly controls: +// P0009R18 +// P0288R9 move_only_function +// P0323R12 +// P0401R6 Providing Size Feedback In The Allocator Interface +// P0448R4 +// P0627R6 unreachable() +// P0798R8 Monadic Operations For optional +// P0881R7 +// P0943R6 Supporting C Atomics In C++ +// P1048R1 is_scoped_enum +// P1072R10 basic_string::resize_and_overwrite +// P1132R7 out_ptr(), inout_ptr() +// P1147R1 Printing volatile Pointers +// P1206R7 Conversions From Ranges To Containers +// P1223R5 ranges::find_last, ranges::find_last_if, ranges::find_last_if_not +// P1272R4 byteswap() +// P1328R1 constexpr type_info::operator==() +// P1425R4 Iterator Pair Constructors For stack And queue +// P1467R9 Extended Floating-Point Types +// (only the header; we don't support any optional extended floating-point types) +// P1659R3 ranges::starts_with, ranges::ends_with +// P1679R3 contains() For basic_string/basic_string_view +// P1682R3 to_underlying() For Enumerations +// P1899R3 views::stride +// P1951R1 Default Template Arguments For pair's Forwarding Constructor +// P1989R2 Range Constructor For string_view +// P2077R3 Heterogeneous Erasure Overloads For Associative Containers +// P2093R14 : Formatted Output +// P2136R3 invoke_r() +// P2164R9 views::enumerate +// P2165R4 Compatibility Between tuple, pair, And tuple-like Objects +// P2166R1 Prohibiting basic_string And basic_string_view Construction From nullptr +// P2186R2 Removing Garbage Collection Support +// P2273R3 constexpr unique_ptr +// P2278R4 cbegin Should Always Return A Constant Iterator +// P2286R8 Formatting Ranges +// (only the '?' format specifier for strings and characters) +// P2291R3 constexpr Integral +// P2302R4 ranges::contains, ranges::contains_subrange +// P2321R2 zip +// P2322R6 ranges::fold_left, ranges::fold_right, Etc. +// P2374R4 views::cartesian_product +// P2387R3 Pipe Support For User-Defined Range Adaptors +// P2404R3 Move-Only Types For Comparison Concepts +// P2417R2 More constexpr bitset +// P2438R2 string::substr() && +// P2440R1 ranges::iota, ranges::shift_left, ranges::shift_right +// P2441R2 views::join_with +// P2442R1 Windowing Range Adaptors: views::chunk, views::slide +// P2443R1 views::chunk_by +// P2445R1 forward_like() +// P2446R2 views::as_rvalue +// P2467R1 ios_base::noreplace: Exclusive Mode For fstreams +// P2474R2 views::repeat +// P2494R2 Relaxing Range Adaptors To Allow Move-Only Types +// P2499R0 string_view Range Constructor Should Be explicit +// P2505R5 Monadic Functions For expected +// P2539R4 Synchronizing print() With The Underlying Stream +// P2540R1 Empty Product For Certain Views +// P2549R1 unexpected::error() +// P2599R2 mdspan: index_type, size_type +// P2604R0 mdspan: data_handle_type, data_handle(), exhaustive +// P2613R1 mdspan: empty() +// P2652R2 Disallowing User Specialization Of allocator_traits +// P2693R1 Formatting thread::id And stacktrace +// P2713R1 Escaping Improvements In std::format +// P2763R1 Fixing layout_stride's Default Constructor For Fully Static Extents +// P2836R1 basic_const_iterator Should Follow Its Underlying Type's Convertibility + +// _HAS_CXX23 and _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS control: +// P1413R3 Deprecate aligned_storage And aligned_union +// P2614R2 Deprecating float_denorm_style, numeric_limits::has_denorm, numeric_limits::has_denorm_loss +// Other C++23 deprecation warnings + +// Parallel Algorithms Notes +// C++ allows an implementation to implement parallel algorithms as calls to the serial algorithms. +// This implementation parallelizes several common algorithm calls, but not all. +// +// std::execution::unseq has no direct analogue for any optimizer we target as of 2020-07-29, +// though we will map it to #pragma loop(ivdep) for the for_each algorithms only as these are the only algorithms where +// the library does not need to introduce inter-loop-body dependencies to accomplish the algorithm's goals. +// +// The following algorithms are parallelized. +// * adjacent_difference +// * adjacent_find +// * all_of +// * any_of +// * count +// * count_if +// * destroy +// * destroy_n +// * equal +// * exclusive_scan +// * find +// * find_end +// * find_first_of +// * find_if +// * find_if_not +// * for_each +// * for_each_n +// * inclusive_scan +// * is_heap +// * is_heap_until +// * is_partitioned +// * is_sorted +// * is_sorted_until +// * mismatch +// * none_of +// * partition +// * reduce +// * remove +// * remove_if +// * replace +// * replace_if +// * search +// * search_n +// * set_difference +// * set_intersection +// * sort +// * stable_sort +// * transform +// * transform_exclusive_scan +// * transform_inclusive_scan +// * transform_reduce +// * uninitialized_default_construct +// * uninitialized_default_construct_n +// * uninitialized_value_construct +// * uninitialized_value_construct_n +// +// The following are not presently parallelized: +// +// No apparent parallelism performance improvement on target hardware; all algorithms which +// merely copy or permute elements with no branches are typically memory bandwidth limited. +// * copy +// * copy_n +// * fill +// * fill_n +// * move +// * reverse +// * reverse_copy +// * rotate +// * rotate_copy +// * shift_left +// * shift_right +// * swap_ranges +// +// Possibly same as above, but not yet tested. +// * uninitialized_copy +// * uninitialized_copy_n +// * uninitialized_fill +// * uninitialized_fill_n +// * uninitialized_move +// * uninitialized_move_n +// +// Confusion over user parallelism requirements exists; likely in the above category anyway. +// * generate +// * generate_n +// +// Effective parallelism suspected to be infeasible. +// * partial_sort +// * partial_sort_copy +// +// Not yet evaluated; parallelism may be implemented in a future release and is suspected to be beneficial. +// * copy_if +// * includes +// * inplace_merge +// * lexicographical_compare +// * max_element +// * merge +// * min_element +// * minmax_element +// * nth_element +// * partition_copy +// * remove_copy +// * remove_copy_if +// * replace_copy +// * replace_copy_if +// * set_symmetric_difference +// * set_union +// * stable_partition +// * unique +// * unique_copy + +#include +#include // The _HAS_CXX tags must be defined before including this. + +#define _STL_STRINGIZE_(S) #S +#define _STL_STRINGIZE(S) _STL_STRINGIZE_(S) + +// Note that _STL_PRAGMA is load-bearing; +// it still needs to exist even once CUDA and ICC support _Pragma. +#if defined(__CUDACC__) || defined(__INTEL_COMPILER) +#define _STL_PRAGMA(PRAGMA) __pragma(PRAGMA) +#else +#define _STL_PRAGMA(PRAGMA) _Pragma(#PRAGMA) +#endif + +#define _STL_PRAGMA_MESSAGE(MESSAGE) _STL_PRAGMA(message(MESSAGE)) +#define _EMIT_STL_MESSAGE(MESSAGE) _STL_PRAGMA_MESSAGE(__FILE__ "(" _STL_STRINGIZE(__LINE__) "): " MESSAGE) + +#define _EMIT_STL_WARNING(NUMBER, MESSAGE) _EMIT_STL_MESSAGE("warning " #NUMBER ": " MESSAGE) +#define _EMIT_STL_ERROR(NUMBER, MESSAGE) static_assert(false, "error " #NUMBER ": " MESSAGE) + +#ifndef _STL_WARNING_LEVEL +#if defined(_MSVC_WARNING_LEVEL) && _MSVC_WARNING_LEVEL >= 4 +#define _STL_WARNING_LEVEL 4 +#else // defined(_MSVC_WARNING_LEVEL) && _MSVC_WARNING_LEVEL >= 4 +#define _STL_WARNING_LEVEL 3 +#endif // defined(_MSVC_WARNING_LEVEL) && _MSVC_WARNING_LEVEL >= 4 +#endif // !defined(_STL_WARNING_LEVEL) + +#if _STL_WARNING_LEVEL < 3 +#error _STL_WARNING_LEVEL cannot be less than 3. +#endif // _STL_WARNING_LEVEL < 3 + +#if _STL_WARNING_LEVEL > 4 +#error _STL_WARNING_LEVEL cannot be greater than 4. +#endif // _STL_WARNING_LEVEL > 4 + +#ifndef __has_cpp_attribute +#define _FALLTHROUGH +#elif __has_cpp_attribute(fallthrough) >= 201603L +#define _FALLTHROUGH [[fallthrough]] +#else +#define _FALLTHROUGH +#endif + +#ifndef __has_cpp_attribute // vvv no attributes vvv +#define _LIKELY +#define _UNLIKELY +#elif __has_cpp_attribute(likely) >= 201803L && __has_cpp_attribute(unlikely) >= 201803L // ^^^ no attr / C++20 attr vvv +#define _LIKELY [[likely]] +#define _UNLIKELY [[unlikely]] +#elif defined(__clang__) // ^^^ C++20 attributes / clang attributes and C++17 or C++14 vvv +#define _LIKELY [[__likely__]] +#define _UNLIKELY [[__unlikely__]] +#else // ^^^ clang attributes and C++17 or C++14 / C1XX attributes and C++17 or C++14 vvv +#define _LIKELY +#define _UNLIKELY +#endif // ^^^ C1XX attributes and C++17 or C++14 ^^^ + +// _HAS_NODISCARD (in vcruntime.h) controls: +// [[nodiscard]] attributes on STL functions + +// TRANSITION, This should go to vcruntime.h +#ifndef __has_cpp_attribute +#define _NODISCARD_MSG(_Msg) +#elif __has_cpp_attribute(nodiscard) >= 201907L +#define _NODISCARD_MSG(_Msg) [[nodiscard(_Msg)]] +#elif __has_cpp_attribute(nodiscard) >= 201603L +#define _NODISCARD_MSG(_Msg) [[nodiscard]] +#else +#define _NODISCARD_MSG(_Msg) +#endif + +#ifndef __has_cpp_attribute +#define _NODISCARD_CTOR +#define _NODISCARD_CTOR_MSG(_Msg) +#elif __has_cpp_attribute(nodiscard) >= 201907L +#define _NODISCARD_CTOR _NODISCARD +#define _NODISCARD_CTOR_MSG(_Msg) _NODISCARD_MSG(_Msg) +#else // ^^^ __has_cpp_attribute(nodiscard) >= 201907L / __has_cpp_attribute(nodiscard) < 201907L vvv +#define _NODISCARD_CTOR +#define _NODISCARD_CTOR_MSG(_Msg) +#endif // ^^^ defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) < 201907L ^^^ + +#if defined(__CUDACC__) && !defined(__clang__) // TRANSITION, VSO-568006 +#define _NODISCARD_FRIEND friend +#else // ^^^ workaround / no workaround vvv +#define _NODISCARD_FRIEND _NODISCARD friend +#endif // ^^^ no workaround ^^^ + +#define _NODISCARD_REMOVE_ALG \ + _NODISCARD_MSG("The 'remove' and 'remove_if' algorithms return the iterator past the last element " \ + "that should be kept. You need to call container.erase(result, container.end()) afterwards. " \ + "In C++20, 'std::erase' and 'std::erase_if' are simpler replacements for these two steps.") + +#define _NODISCARD_UNIQUE_ALG \ + _NODISCARD_MSG("The 'unique' algorithm returns the iterator past the last element that should be kept. " \ + "You need to call container.erase(result, container.end()) afterwards.") + +#define _NODISCARD_EMPTY_MEMBER \ + _NODISCARD_MSG( \ + "This member function returns a bool indicating whether the container is empty and has no other effects. " \ + "It is not useful to call this member function and discard the return value. " \ + "Use the 'clear()' member function if you want to erase all elements.") + +#define _NODISCARD_EMPTY_ARRAY_MEMBER \ + _NODISCARD_MSG( \ + "This member function returns a bool indicating whether the container is empty and has no other effects. " \ + "It is not useful to call this member function and discard the return value. " \ + "There's no way to clear an array as its size is fixed.") + +#define _NODISCARD_EMPTY_STACKTRACE_MEMBER \ + _NODISCARD_MSG( \ + "This member function returns a bool indicating whether the container is empty and has no other effects. " \ + "It is not useful to call this member function and discard the return value. " \ + "'std::stacktrace' can be cleared by assigning an empty value to it.") + +#define _NODISCARD_EMPTY_NON_MEMBER \ + _NODISCARD_MSG( \ + "This function returns a bool indicating whether the container or container-like object is empty and " \ + "has no other effects. It is not useful to call this function and discard the return value.") + +#define _NODISCARD_EMPTY_ADAPTOR_MEMBER \ + _NODISCARD_MSG( \ + "This member function returns a bool indicating whether the container is empty and has no other effects. " \ + "It is not useful to call this member function and discard the return value. " \ + "Container adaptors don't provide 'clear()' member functions, but you can assign an empty object to them.") + +#define _NODISCARD_BARRIER_TOKEN \ + _NODISCARD_MSG("The token from 'arrive()' should not be discarded; it should be passed to 'wait()'.") + +#define _NODISCARD_TRY_WAIT \ + _NODISCARD_MSG( \ + "This member function returns the state of the synchronization object and does not do anything else; " \ + "it is not useful to call this member function and discard the return value.") + +#define _NODISCARD_TRY_CHANGE_STATE \ + _NODISCARD_MSG("This function returns whether the operation succeeded in modifying object state. " \ + "It is dangerous to ignore the return value.") + +#define _NODISCARD_SMART_PTR_ALLOC \ + _NODISCARD_MSG("This function constructs an object wrapped by a smart pointer and has no other effects; " \ + "it is not useful to call this function and discard the return value.") + +#define _NODISCARD_RAW_PTR_ALLOC \ + _NODISCARD_MSG("This function allocates memory and returns a raw pointer. " \ + "Discarding the return value will cause a memory leak.") + +#define _NODISCARD_ASSUME_ALIGNED \ + _NODISCARD_MSG("'std::assume_aligned' has a potential effect on the return value (not on the passed argument). " \ + "It is not useful to call 'std::assume_aligned' and discard the return value.") + +#define _NODISCARD_LAUNDER \ + _NODISCARD_MSG("'std::launder' has a potential effect on the return value (not on the passed argument). " \ + "It is not useful to call 'std::launder' and discard the return value.") + +#ifdef _SILENCE_NODISCARD_LOCK_WARNINGS + +#define _NODISCARD_LOCK +#define _NODISCARD_CTOR_LOCK + +#else // ^^^ defined(_SILENCE_NODISCARD_LOCK_WARNINGS) / !defined(_SILENCE_NODISCARD_LOCK_WARNINGS) vvv + +#define _NODISCARD_LOCK \ + _NODISCARD_MSG("A lock should be stored in a variable to protect the scope. If you're intentionally constructing " \ + "a temporary to protect the rest of the current expression using the comma operator, you can cast " \ + "the temporary to void or define _SILENCE_NODISCARD_LOCK_WARNINGS to suppress this warning.") + +#define _NODISCARD_CTOR_LOCK \ + _NODISCARD_CTOR_MSG( \ + "A lock should be stored in a variable to protect the scope. If you're intentionally constructing " \ + "a temporary to protect the rest of the current expression using the comma operator, you can cast " \ + "the temporary to void or define _SILENCE_NODISCARD_LOCK_WARNINGS to suppress this warning.") + +#endif // ^^^ !defined(_SILENCE_NODISCARD_LOCK_WARNINGS) ^^^ + +#define _NODISCARD_CTOR_THREAD \ + _NODISCARD_CTOR_MSG("This temporary 'std::thread' is not joined or detached, " \ + "so 'std::terminate' will be called at the end of the statement.") + +#define _NODISCARD_CTOR_JTHREAD \ + _NODISCARD_CTOR_MSG("This temporary 'std::jthread' is implicitly joined at the end of the statement. " \ + "If this is intentional, you can add '.join()' to suppress this warning. " \ + "Otherwise, this 'std::jthread' should be stored in a variable.") + +#define _NODISCARD_ASYNC \ + _NODISCARD_MSG("The result of 'std::async' should be stored in a variable. If the return value is discarded, " \ + "the temporary 'std::future' is destroyed, waiting for an async result or evaluating " \ + "a deferred result, thus defeating the purpose of 'std::async'.") + +#define _NODISCARD_GET_FUTURE \ + _NODISCARD_MSG("Since 'get_future' may be called only once, discarding the result is likely a mistake.") + +#pragma push_macro("msvc") +#pragma push_macro("known_semantics") +#pragma push_macro("noop_dtor") +#pragma push_macro("intrinsic") +#pragma push_macro("lifetimebound") +#undef msvc +#undef known_semantics +#undef noop_dtor +#undef intrinsic +#undef lifetimebound + +#ifndef __has_cpp_attribute +#define _HAS_MSVC_ATTRIBUTE(x) 0 +#elif defined(__CUDACC__) // TRANSITION, CUDA - warning: attribute namespace "msvc" is unrecognized +#define _HAS_MSVC_ATTRIBUTE(x) 0 +#else +#define _HAS_MSVC_ATTRIBUTE(x) __has_cpp_attribute(msvc::x) +#endif + +// Should we use [[msvc::known_semantics]] to tell the compiler that certain +// type trait specializations have the standard-mandated semantics? +#if _HAS_MSVC_ATTRIBUTE(known_semantics) +#define _MSVC_KNOWN_SEMANTICS [[msvc::known_semantics]] +#else +#define _MSVC_KNOWN_SEMANTICS +#endif + +// Should we use [[msvc::noop_dtor]] to tell the compiler that some non-trivial +// destructors have no effects? +#if _HAS_MSVC_ATTRIBUTE(noop_dtor) +#define _MSVC_NOOP_DTOR [[msvc::noop_dtor]] +#else +#define _MSVC_NOOP_DTOR +#endif + +// Should we use [[msvc::intrinsic]] allowing the compiler to implement the +// behavior of certain trivial functions? +#if _HAS_MSVC_ATTRIBUTE(intrinsic) +#define _MSVC_INTRINSIC [[msvc::intrinsic]] +#else +#define _MSVC_INTRINSIC +#endif + +// Should we enable [[msvc::lifetimebound]] or [[clang::lifetimebound]] warnings? +#if !defined(__has_cpp_attribute) || defined(_SILENCE_LIFETIMEBOUND_WARNING) +#define _MSVC_LIFETIMEBOUND +#elif _HAS_MSVC_ATTRIBUTE(lifetimebound) +#define _MSVC_LIFETIMEBOUND [[msvc::lifetimebound]] +#elif __has_cpp_attribute(_Clang::__lifetimebound__) +#define _MSVC_LIFETIMEBOUND [[_Clang::__lifetimebound__]] +#else +#define _MSVC_LIFETIMEBOUND +#endif + +#undef _HAS_MSVC_ATTRIBUTE +#pragma pop_macro("lifetimebound") +#pragma pop_macro("intrinsic") +#pragma pop_macro("noop_dtor") +#pragma pop_macro("known_semantics") +#pragma pop_macro("msvc") + +// warning C4577: 'noexcept' used with no exception handling mode specified; +// termination on exception is not guaranteed. Specify /EHsc (/Wall) +#if _HAS_EXCEPTIONS +#define _STL_DISABLED_WARNING_C4577 +#else +#define _STL_DISABLED_WARNING_C4577 4577 +#endif + +// warning C4984: 'if constexpr' is a C++17 language extension +#if !_HAS_CXX17 +#define _STL_DISABLED_WARNING_C4984 4984 +#else +#define _STL_DISABLED_WARNING_C4984 +#endif + +// warning C5053: support for 'explicit()' in C++17 and earlier is a vendor extension +#if !_HAS_CXX20 +#define _STL_DISABLED_WARNING_C5053 5053 +#else +#define _STL_DISABLED_WARNING_C5053 +#endif + +#ifndef _STL_EXTRA_DISABLED_WARNINGS +#define _STL_EXTRA_DISABLED_WARNINGS +#endif // !defined(_STL_EXTRA_DISABLED_WARNINGS) + +// warning C4180: qualifier applied to function type has no meaning; ignored +// warning C4324: structure was padded due to alignment specifier +// warning C4412: function signature contains type 'meow'; C++ objects are unsafe to pass between pure code +// and mixed or native. (/Wall) +// warning C4455: literal suffix identifiers that do not start with an underscore are reserved +// warning C4494: Ignoring __declspec(allocator) because the function return type is not a pointer or reference +// warning C4514: unreferenced inline function has been removed (/Wall) +// warning C4574: 'MACRO' is defined to be '0': did you mean to use '#if MACRO'? (/Wall) +// warning C4582: 'union': constructor is not implicitly called (/Wall) +// warning C4583: 'union': destructor is not implicitly called (/Wall) +// warning C4587: behavior change: constructor is no longer implicitly called (/Wall) +// warning C4588: behavior change: destructor is no longer implicitly called (/Wall) +// warning C4619: #pragma warning: there is no warning number 'number' (/Wall) +// warning C4623: default constructor was implicitly defined as deleted (/Wall) +// warning C4625: copy constructor was implicitly defined as deleted (/Wall) +// warning C4626: assignment operator was implicitly defined as deleted (/Wall) +// warning C4643: Forward declaring 'meow' in namespace std is not permitted by the C++ Standard. (/Wall) +// warning C4648: standard attribute 'meow' is ignored +// warning C4702: unreachable code +// warning C4793: function compiled as native +// warning C4820: 'N' bytes padding added after data member 'meow' (/Wall) +// warning C4868: compiler may not enforce left-to-right evaluation order in braced initializer list (/Wall) +// warning C4988: variable declared outside class/function scope (/Wall /d1WarnOnGlobals) +// warning C5026: move constructor was implicitly defined as deleted (/Wall) +// warning C5027: move assignment operator was implicitly defined as deleted (/Wall) +// warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified (/Wall) +// warning C5220: a non-static data member with a volatile qualified type no longer implies that compiler generated +// copy/move constructors and copy/move assignment operators are not trivial (/Wall) +// warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed + +#ifndef _STL_DISABLED_WARNINGS +// clang-format off +#define _STL_DISABLED_WARNINGS \ + 4180 4324 4412 4455 4494 4514 4574 4582 4583 4587 \ + 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 \ + 4868 4988 5026 5027 5045 5220 6294 \ + _STL_DISABLED_WARNING_C4577 \ + _STL_DISABLED_WARNING_C4984 \ + _STL_DISABLED_WARNING_C5053 \ + _STL_EXTRA_DISABLED_WARNINGS +// clang-format on +#endif // !defined(_STL_DISABLED_WARNINGS) + +// warning: constexpr if is a C++17 extension [-Wc++17-extensions] +// warning: explicit(bool) is a C++20 extension [-Wc++20-extensions] +// warning: declaring overloaded 'operator()' as 'static' is a C++23 extension [-Wc++23-extensions] +// warning: ignoring __declspec(allocator) because the function return type '%s' is not a pointer or reference type +// [-Wignored-attributes] +// warning: '#pragma float_control' is not supported on this target - ignored [-Wignored-pragmas] +// warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] +// warning: unknown pragma ignored [-Wunknown-pragmas] +#ifndef _STL_DISABLE_CLANG_WARNINGS +#ifdef __clang__ +// clang-format off +#define _STL_DISABLE_CLANG_WARNINGS \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++20-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++23-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wignored-attributes\"") \ + _Pragma("clang diagnostic ignored \"-Wignored-pragmas\"") \ + _Pragma("clang diagnostic ignored \"-Wuser-defined-literals\"") \ + _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +// clang-format on +#else // ^^^ defined(__clang__) / !defined(__clang__) vvv +#define _STL_DISABLE_CLANG_WARNINGS +#endif // ^^^ !defined(__clang__) ^^^ +#endif // !defined(_STL_DISABLE_CLANG_WARNINGS) + +#ifndef _STL_RESTORE_CLANG_WARNINGS +#ifdef __clang__ +#define _STL_RESTORE_CLANG_WARNINGS _Pragma("clang diagnostic pop") +#else // ^^^ defined(__clang__) / !defined(__clang__) vvv +#define _STL_RESTORE_CLANG_WARNINGS +#endif // ^^^ !defined(__clang__) ^^^ +#endif // !defined(_STL_RESTORE_CLANG_WARNINGS) + +// clang-format off +#ifndef _STL_DISABLE_DEPRECATED_WARNING +#ifdef __clang__ +#define _STL_DISABLE_DEPRECATED_WARNING \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif defined(__CUDACC__) || defined(__INTEL_COMPILER) +#define _STL_DISABLE_DEPRECATED_WARNING \ + __pragma(warning(push)) \ + __pragma(warning(disable : 4996)) // was declared deprecated +#else // vvv MSVC vvv +#define _STL_DISABLE_DEPRECATED_WARNING \ + _Pragma("warning(push)") \ + _Pragma("warning(disable : 4996)") // was declared deprecated +#endif // ^^^ MSVC ^^^ +#endif // _STL_DISABLE_DEPRECATED_WARNING +// clang-format on + +#ifndef _STL_RESTORE_DEPRECATED_WARNING +#ifdef __clang__ +#define _STL_RESTORE_DEPRECATED_WARNING _Pragma("clang diagnostic pop") +#elif defined(__CUDACC__) || defined(__INTEL_COMPILER) +#define _STL_RESTORE_DEPRECATED_WARNING __pragma(warning(pop)) +#else // vvv MSVC vvv +#define _STL_RESTORE_DEPRECATED_WARNING _Pragma("warning(pop)") +#endif // ^^^ MSVC ^^^ +#endif // !defined(_STL_RESTORE_DEPRECATED_WARNING) + +#define _CPPLIB_VER 650 +#define _MSVC_STL_VERSION 143 +#define _MSVC_STL_UPDATE 202402L + +#ifndef _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH +#if defined(__CUDACC__) && defined(__CUDACC_VER_MAJOR__) +#if __CUDACC_VER_MAJOR__ < 11 || (__CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ < 6) +_EMIT_STL_ERROR(STL1002, "Unexpected compiler version, expected CUDA 11.6 or newer."); +#endif // ^^^ old CUDA ^^^ +#elif defined(__EDG__) +// not attempting to detect __EDG_VERSION__ being less than expected +#elif defined(__clang__) +#if __clang_major__ < 17 +_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 17.0.0 or newer."); +#endif // ^^^ old Clang ^^^ +#elif defined(_MSC_VER) +#if _MSC_VER < 1940 // Coarse-grained, not inspecting _MSC_FULL_VER +_EMIT_STL_ERROR(STL1001, "Unexpected compiler version, expected MSVC 19.40 or newer."); +#endif // ^^^ old MSVC ^^^ +#else // vvv other compilers vvv +// not attempting to detect other compilers +#endif // ^^^ other compilers ^^^ +#endif // !defined(_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) + +#ifndef _HAS_STATIC_RTTI +#define _HAS_STATIC_RTTI 1 +#endif // !defined(_HAS_STATIC_RTTI) + +#if defined(_CPPRTTI) && !_HAS_STATIC_RTTI +#error /GR implies _HAS_STATIC_RTTI. +#endif // defined(_CPPRTTI) && !_HAS_STATIC_RTTI + +// N4950 [dcl.constexpr]/1: "A function or static data member declared with the +// constexpr or consteval specifier is implicitly an inline function or variable" + +// Functions that became constexpr in C++17 +#if _HAS_CXX17 +#define _CONSTEXPR17 constexpr +#else // ^^^ constexpr in C++17 and later / inline (not constexpr) in C++14 vvv +#define _CONSTEXPR17 inline +#endif // ^^^ inline (not constexpr) in C++14 ^^^ + +// Functions that became constexpr in C++20 +#if _HAS_CXX20 +#define _CONSTEXPR20 constexpr +#else // ^^^ constexpr in C++20 and later / inline (not constexpr) in C++17 and earlier vvv +#define _CONSTEXPR20 inline +#endif // ^^^ inline (not constexpr) in C++17 and earlier ^^^ + +// Functions that became constexpr in C++23 +#if _HAS_CXX23 +#define _CONSTEXPR23 constexpr +#else // ^^^ constexpr in C++23 and later / inline (not constexpr) in C++20 and earlier vvv +#define _CONSTEXPR23 inline +#endif // ^^^ inline (not constexpr) in C++20 and earlier ^^^ + +// P2465R3 Standard Library Modules std And std.compat +#ifdef _BUILD_STD_MODULE +#if !_HAS_CXX20 +#error The Standard Library Modules are available only with C++20 or later. +#endif // ^^^ !_HAS_CXX20 ^^^ +#define _EXPORT_STD export +#else // ^^^ defined(_BUILD_STD_MODULE) / !defined(_BUILD_STD_MODULE) vvv +#define _EXPORT_STD +#endif // ^^^ !defined(_BUILD_STD_MODULE) ^^^ + +// P0607R0 Inline Variables For The STL +#if _HAS_CXX17 +#define _INLINE_VAR inline +#else +#define _INLINE_VAR +#endif + +// N4190 Removing auto_ptr, random_shuffle(), And Old Stuff +#ifndef _HAS_AUTO_PTR_ETC +#define _HAS_AUTO_PTR_ETC (!_HAS_CXX17) +#endif // !defined(_HAS_AUTO_PTR_ETC) + +// P0003R5 Removing Dynamic Exception Specifications +#ifndef _HAS_UNEXPECTED +#define _HAS_UNEXPECTED (!_HAS_CXX17) +#endif // !defined(_HAS_UNEXPECTED) + +#if _HAS_UNEXPECTED && _HAS_CXX23 +_EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpected."); +#endif // _HAS_UNEXPECTED && _HAS_CXX23 + +// P0004R1 Removing Deprecated Iostreams Aliases +#ifndef _HAS_OLD_IOSTREAMS_MEMBERS +#define _HAS_OLD_IOSTREAMS_MEMBERS (!_HAS_CXX17) +#endif // !defined(_HAS_OLD_IOSTREAMS_MEMBERS) + +// P0298R3 std::byte +#ifndef _HAS_STD_BYTE +#define _HAS_STD_BYTE _HAS_CXX17 +#endif // !defined(_HAS_STD_BYTE) + +// P0302R1 Removing Allocator Support In std::function +// LWG-2385 function::assign allocator argument doesn't make sense +// LWG-2921 packaged_task and type-erased allocators +// LWG-2976 Dangling uses_allocator specialization for packaged_task +#ifndef _HAS_FUNCTION_ALLOCATOR_SUPPORT +#define _HAS_FUNCTION_ALLOCATOR_SUPPORT (!_HAS_CXX17) +#endif // !defined(_HAS_FUNCTION_ALLOCATOR_SUPPORT) + +// The non-Standard std::tr1 namespace and TR1-only machinery +#ifndef _HAS_TR1_NAMESPACE +#define _HAS_TR1_NAMESPACE (!_HAS_CXX17) +#endif // !defined(_HAS_TR1_NAMESPACE) + +// STL4000 is "_STATIC_CPPLIB is deprecated", currently in yvals.h +// STL4001 is "/clr:pure is deprecated", currently in yvals.h + +#if _HAS_TR1_NAMESPACE +#ifdef _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING +#define _DEPRECATE_TR1_NAMESPACE +#else // ^^^ warning disabled / warning enabled vvv +#define _DEPRECATE_TR1_NAMESPACE \ + [[deprecated( \ + "warning STL4002: " \ + "The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED. You can " \ + "define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING to suppress this warning.")]] +#endif // ^^^ warning enabled ^^^ +#endif // _HAS_TR1_NAMESPACE + +// STL4003 was "The non-Standard std::identity struct is deprecated and will be REMOVED." + +// Enforcement of matching allocator value_types +#ifndef _ENFORCE_MATCHING_ALLOCATORS +#define _ENFORCE_MATCHING_ALLOCATORS _HAS_CXX17 +#endif // !defined(_ENFORCE_MATCHING_ALLOCATORS) + +#define _MISMATCHED_ALLOCATOR_MESSAGE(_CONTAINER, _VALUE_TYPE) \ + _CONTAINER " requires that Allocator's value_type match " _VALUE_TYPE " (See N4950 [container.alloc.reqmts]/5)" \ + " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" \ + " to suppress this error." + +// Enforcement of Standard facet specializations +#ifndef _ENFORCE_FACET_SPECIALIZATIONS +#define _ENFORCE_FACET_SPECIALIZATIONS 0 +#endif // !defined(_ENFORCE_FACET_SPECIALIZATIONS) + +#define _FACET_SPECIALIZATION_MESSAGE \ + "Unsupported facet specialization; see N4950 [locale.category]. " \ + "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " \ + "to suppress this error." + +// To improve compiler throughput, use 'hidden friend' operators in instead of non-members that are +// depicted in the Standard. +#ifndef _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS +#define _STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS 1 +#endif // !defined(_STL_OPTIMIZE_SYSTEM_ERROR_OPERATORS) + +// Controls whether the STL will force /fp:fast to enable vectorization of algorithms defined +// in the standard as special cases; such as reduce, transform_reduce, inclusive_scan, exclusive_scan +#ifndef _STD_VECTORIZE_WITH_FLOAT_CONTROL +#ifdef _M_FP_EXCEPT +#define _STD_VECTORIZE_WITH_FLOAT_CONTROL 0 +#else // ^^^ floating-point exceptions enabled / floating-point exceptions disabled (default) vvv +#define _STD_VECTORIZE_WITH_FLOAT_CONTROL 1 +#endif // ^^^ floating-point exceptions disabled (default) ^^^ +#endif // !defined(_STD_VECTORIZE_WITH_FLOAT_CONTROL) + +// P0174R2 Deprecating Vestigial Library Parts +// P0521R0 Deprecating shared_ptr::unique() +// Other C++17 deprecation warnings + +// N4659 D.4 [depr.cpp.headers] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_C_HEADER \ + [[deprecated("warning STL4004: " \ + ", , , and are deprecated in C++17. " \ + "You can define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_C_HEADER +#endif // ^^^ warning disabled ^^^ + +// N4659 D.6 [depr.str.strstreams] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_STRSTREAM_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_STRSTREAM \ + [[deprecated("warning STL4005: is deprecated in C++17. " \ + "You can define _SILENCE_CXX17_STRSTREAM_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_STRSTREAM +#endif // ^^^ warning disabled ^^^ + +// N4659 D.7 [depr.uncaught] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_UNCAUGHT_EXCEPTION \ + [[deprecated("warning STL4006: " \ + "std::uncaught_exception() is deprecated in C++17. " \ + "It is superseded by std::uncaught_exceptions(), plural. " \ + "You can define _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_UNCAUGHT_EXCEPTION +#endif // ^^^ warning disabled ^^^ + +// N4659 D.8.1 [depr.weak.result_type] +// N4659 D.8.2 [depr.func.adaptor.typedefs] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS \ + [[deprecated( \ + "warning STL4007: Many result_type typedefs " \ + "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " \ + "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS +#endif // ^^^ warning disabled ^^^ + +// N4659 D.8.3 [depr.negators] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_NEGATORS \ + [[deprecated("warning STL4008: " \ + "std::not1(), std::not2(), std::unary_negate, and std::binary_negate are deprecated in C++17. " \ + "They are superseded by std::not_fn(). " \ + "You can define _SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_NEGATORS +#endif // ^^^ warning disabled ^^^ + +// STL4009 was "std::allocator is deprecated in C++17" + +// N4659 D.9 [depr.default.allocator] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS \ + [[deprecated("warning STL4010: " \ + "Various members of std::allocator are deprecated in C++17. " \ + "Use std::allocator_traits instead of accessing these members directly. " \ + "You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS +#endif // ^^^ warning disabled ^^^ + +// N4659 D.10 [depr.storage.iterator] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_RAW_STORAGE_ITERATOR_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_RAW_STORAGE_ITERATOR \ + [[deprecated("warning STL4011: " \ + "std::raw_storage_iterator is deprecated in C++17. " \ + "Consider using the std::uninitialized_copy() family of algorithms instead. " \ + "You can define _SILENCE_CXX17_RAW_STORAGE_ITERATOR_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_RAW_STORAGE_ITERATOR +#endif // ^^^ warning disabled ^^^ + +// N4659 D.11 [depr.temporary.buffer] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_TEMPORARY_BUFFER_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_TEMPORARY_BUFFER \ + [[deprecated("warning STL4012: " \ + "std::get_temporary_buffer() and std::return_temporary_buffer() are deprecated in C++17. " \ + "You can define _SILENCE_CXX17_TEMPORARY_BUFFER_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_TEMPORARY_BUFFER +#endif // ^^^ warning disabled ^^^ + +// N4659 D.12 [depr.meta.types] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_IS_LITERAL_TYPE_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_IS_LITERAL_TYPE \ + [[deprecated("warning STL4013: " \ + "std::is_literal_type and std::is_literal_type_v are deprecated in C++17. " \ + "You can define _SILENCE_CXX17_IS_LITERAL_TYPE_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_IS_LITERAL_TYPE +#endif // ^^^ warning disabled ^^^ + +// N4659 D.12 [depr.meta.types] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_RESULT_OF \ + [[deprecated("warning STL4014: " \ + "std::result_of and std::result_of_t are deprecated in C++17. " \ + "They are superseded by std::invoke_result and std::invoke_result_t. " \ + "You can define _SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_RESULT_OF +#endif // ^^^ warning disabled ^^^ + +// N4659 D.13 [depr.iterator.primitives] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_ITERATOR_BASE_CLASS \ + [[deprecated( \ + "warning STL4015: " \ + "The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. " \ + "(The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to " \ + "derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing " \ + "publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. " \ + "Note that value_type is required to be non-const, even for constant iterators. " \ + "You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_ITERATOR_BASE_CLASS +#endif // ^^^ warning disabled ^^^ + +// N4659 D.14 [depr.util.smartptr.shared.obs] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_SHARED_PTR_UNIQUE_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_SHARED_PTR_UNIQUE \ + [[deprecated("warning STL4016: " \ + "std::shared_ptr::unique() is deprecated in C++17. " \ + "You can define _SILENCE_CXX17_SHARED_PTR_UNIQUE_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_SHARED_PTR_UNIQUE +#endif // ^^^ warning disabled ^^^ + +// N4659 D.15 [depr.locale.stdcvt] +// N4659 D.16 [depr.conversions] +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_CODECVT_HEADER \ + [[deprecated( \ + "warning STL4017: " \ + "std::wbuffer_convert, std::wstring_convert, and the header (containing std::codecvt_mode, " \ + "std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. " \ + "(The std::codecvt class template is NOT deprecated.) " \ + "The C++ Standard doesn't provide equivalent non-deprecated functionality; " \ + "consider using MultiByteToWideChar() and WideCharToMultiByte() from instead. " \ + "You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_CODECVT_HEADER +#endif // ^^^ warning disabled ^^^ + +// STL4018 was "The non-Standard std::tr2::sys namespace is deprecated and will be REMOVED." + +#ifdef _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING +#define _DEPRECATE_FPOS_SEEKPOS +#else // ^^^ warning disabled / warning enabled vvv +#define _DEPRECATE_FPOS_SEEKPOS \ + [[deprecated("warning STL4019: " \ + "The member std::fpos::seekpos() is non-Standard, and is preserved only for compatibility with " \ + "workarounds for old versions of Visual C++. It will be removed in a future release, and in this " \ + "release always returns 0. Please use standards-conforming mechanisms to manipulate fpos, such as " \ + "conversions to and from streamoff, or an integral type, instead. If you are receiving this message " \ + "while compiling Boost.IOStreams, a fix has been submitted upstream to make Boost use " \ + "standards-conforming mechanisms, as it does for other compilers. You can define " \ + "_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING to suppress this warning, " \ + "or define _REMOVE_FPOS_SEEKPOS to remove std::fpos::seekpos entirely.")]] +#endif // ^^^ warning enabled ^^^ + +// P0482R6 Library Support For char8_t +// Other C++20 deprecation warnings + +// N4868 D.23 [depr.locale.category] +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_CODECVT_FACETS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_CODECVT_FACETS \ + [[deprecated("warning STL4020: " \ + "std::codecvt, std::codecvt, " \ + "std::codecvt_byname, and std::codecvt_byname " \ + "are deprecated in C++20 and replaced by specializations with a second argument of type char8_t. " \ + "You can define _SILENCE_CXX20_CODECVT_FACETS_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_CODECVT_FACETS +#endif // ^^^ warning disabled ^^^ + +// N4868 D.24 [depr.fs.path.factory] +#if _HAS_CXX20 && defined(__cpp_char8_t) && !defined(_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_U8PATH \ + [[deprecated("warning STL4021: " \ + "The std::filesystem::u8path() overloads are deprecated in C++20. " \ + "The constructors of std::filesystem::path provide equivalent functionality via construction from " \ + "u8string, u8string_view, or iterators with value_type char8_t. " \ + "You can define _SILENCE_CXX20_U8PATH_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_U8PATH +#endif // ^^^ warning disabled ^^^ + +#if !defined(_SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING) +#define _DEPRECATE_STDEXT_HASH_LOWER_BOUND \ + [[deprecated( \ + "warning STL4022: " \ + "The hash_meow and unordered_meow containers' non-Standard lower_bound() member was provided for interface " \ + "compatibility with the ordered associative containers, and doesn't match the semantics of the " \ + "hash_meow or unordered_meow containers. Please use the find() member instead. You can define " \ + "_SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_STDEXT_HASH_LOWER_BOUND +#endif // ^^^ warning disabled ^^^ + +#if !defined(_SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING) +#define _DEPRECATE_STDEXT_HASH_UPPER_BOUND \ + [[deprecated( \ + "warning STL4023: " \ + "The hash_meow and unordered_meow containers' non-Standard upper_bound() member was provided for interface " \ + "compatibility with the ordered associative containers, and doesn't match the semantics of the " \ + "hash_meow or unordered_meow containers. Please use the second iterator returned by the " \ + "equal_range() member instead. You can define " \ + "_SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_STDEXT_HASH_UPPER_BOUND +#endif // ^^^ warning disabled ^^^ + +// P0966R1 [depr.string.capacity] +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_STRING_RESERVE_WITHOUT_ARGUMENT_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_STRING_RESERVE_WITHOUT_ARGUMENT \ + [[deprecated("warning STL4024: " \ + "std::string::reserve() without an argument is deprecated in C++20. " \ + "To shrink the string's capacity, use std::string::shrink_to_fit() instead. Otherwise, provide an " \ + "argument to std::string::reserve(). " \ + "You can define _SILENCE_CXX20_STRING_RESERVE_WITHOUT_ARGUMENT_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_STRING_RESERVE_WITHOUT_ARGUMENT +#endif // ^^^ warning disabled ^^^ + +// P0767R1 [depr.meta.types] +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_IS_POD_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_IS_POD \ + [[deprecated("warning STL4025: " \ + "std::is_pod and std::is_pod_v are deprecated in C++20. " \ + "The std::is_trivially_copyable and/or std::is_standard_layout traits likely suit your use case. " \ + "You can define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_IS_POD +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_EXPERIMENTAL_ERASE_DEPRECATION_WARNING) +#define _DEPRECATE_EXPERIMENTAL_ERASE \ + [[deprecated("warning STL4026: " \ + "std::experimental::erase() and std::experimental::erase_if() are deprecated by Microsoft and will " \ + "be REMOVED. They are superseded by std::erase() and std::erase_if(). " \ + "You can define _SILENCE_EXPERIMENTAL_ERASE_DEPRECATION_WARNING to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_EXPERIMENTAL_ERASE +#endif // ^^^ warning disabled ^^^ + +// P0768R1 [depr.relops] +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_REL_OPS \ + [[deprecated("warning STL4027: " \ + "The namespace std::rel_ops and its contents are deprecated in C++20. " \ + "Their use is superseded by C++20's <=> operator and automatic rewrites of relational expressions. " \ + "You can define _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING or " \ + "_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_REL_OPS +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_ATOMIC_INIT_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_ATOMIC_INIT \ + [[deprecated("warning STL4028: " \ + "std::atomic_init() overloads are deprecated in C++20. " \ + "The constructors of std::atomic provide equivalent functionality. " \ + "You can define _SILENCE_CXX20_ATOMIC_INIT_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_ATOMIC_INIT +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_OLD_SHARED_PTR_ATOMIC_SUPPORT \ + [[deprecated("warning STL4029: " \ + "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " \ + "The shared_ptr specialization of std::atomic provides superior functionality. " \ + "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_OLD_SHARED_PTR_ATOMIC_SUPPORT +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_VOLATILE \ + [[deprecated("warning STL4030: " \ + "Some operations on volatile-qualified types in the STL are deprecated in C++20. " \ + "You can define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_VOLATILE +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_MOVE_ITERATOR_ARROW_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_MOVE_ITERATOR_ARROW \ + [[deprecated("warning STL4031: " \ + "std::move_iterator::operator->() is deprecated in C++20. " \ + "You can define _SILENCE_CXX20_MOVE_ITERATOR_ARROW_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_MOVE_ITERATOR_ARROW +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX17 && !defined(_SILENCE_CXX17_POLYMORPHIC_ALLOCATOR_DESTROY_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS) +#define _CXX17_DEPRECATE_POLYMORPHIC_ALLOCATOR_DESTROY \ + [[deprecated("warning STL4032: " \ + "std::pmr::polymorphic_allocator::destroy() is deprecated in C++17 by LWG-3036. " \ + "Prefer std::destroy_at() or std::allocator_traits::destroy(). " \ + "You can define _SILENCE_CXX17_POLYMORPHIC_ALLOCATOR_DESTROY_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX17_DEPRECATE_POLYMORPHIC_ALLOCATOR_DESTROY +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_IS_ALWAYS_EQUAL_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_DEPRECATE_IS_ALWAYS_EQUAL \ + [[deprecated("warning STL4033: " \ + "std::allocator::is_always_equal is deprecated in C++20 by LWG-3170. " \ + "Prefer std::allocator_traits>::is_always_equal. " \ + "You can define _SILENCE_CXX20_IS_ALWAYS_EQUAL_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_DEPRECATE_IS_ALWAYS_EQUAL +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_ALIGNED_STORAGE \ + [[deprecated("warning STL4034: " \ + "std::aligned_storage and std::aligned_storage_t are deprecated in C++23. " \ + "Prefer alignas(T) std::byte t_buff[sizeof(T)]. " \ + "You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_ALIGNED_STORAGE +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_ALIGNED_UNION \ + [[deprecated("warning STL4035: " \ + "std::aligned_union and std::aligned_union_t are deprecated in C++23. " \ + "Prefer alignas(Ts...) std::byte t_buff[std::max({sizeof(Ts)...})]. " \ + "You can define _SILENCE_CXX23_ALIGNED_UNION_DEPRECATION_WARNING " \ + "or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_ALIGNED_UNION +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX20 && !defined(_SILENCE_CXX20_CISO646_REMOVED_WARNING) && !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS) +#define _CXX20_REMOVE_CISO646 \ + [[deprecated("warning STL4036: " \ + " is removed in C++20. " \ + "You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING " \ + "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX20_REMOVE_CISO646 +#endif // ^^^ warning disabled ^^^ + +#if !defined(_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING) +#define _DEPRECATE_NONFLOATING_COMPLEX \ + [[deprecated("warning STL4037: " \ + "The effect of instantiating the template std::complex for any " \ + "type other than float, double, or long double is unspecified. " \ + "You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to " \ + "suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_NONFLOATING_COMPLEX +#endif // ^^^ warning disabled ^^^ + +// STL4038 is used to warn that "The contents of are available only with C++NN or later." + +// STL4039 is used to warn that "The contents of are not available with /await." + +// STL4040 is used to warn that "The contents of require static RTTI." + +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_UNIX_STREAMS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_UNIX_STREAMS \ + [[deprecated( \ + "warning STL4041: " \ + "std::errc enumerators std::errc::no_message_available, std::errc::no_stream_resources, " \ + "std::errc::not_a_stream, and std::errc::stream_timeout and their corresponding errno macros ENODATA, ENOSR, " \ + "ENOSTR, and ETIME are deprecated in C++23 by LWG-3869. These errno macros are deprecated in POSIX 2008 and " \ + "removed in POSIX 202x. You can define _SILENCE_CXX23_UNIX_STREAMS_DEPRECATION_WARNING or " \ + "_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_UNIX_STREAMS +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENORM_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_DENORM \ + [[deprecated("warning STL4042: " \ + "std::float_denorm_style, std::numeric_limits::has_denorm, and std::numeric_limits::has_denorm_loss " \ + "are deprecated in C++23. You can define _SILENCE_CXX23_DENORM_DEPRECATION_WARNING or " \ + "_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_DENORM +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX17 && !defined(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS) +#define _DEPRECATE_STDEXT_ARR_ITERS \ + [[deprecated( \ + "warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory " \ + "functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and " \ + "gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or " \ + "_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_STDEXT_ARR_ITERS +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX17 && !defined(_SILENCE_STDEXT_CVT_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS) +#define _DEPRECATE_STDEXT_CVT \ + [[deprecated("warning STL4044: The contents of the stdext::cvt namespace are non-Standard extensions and will be " \ + "removed in the future. The MultiByteToWideChar() and WideCharToMultiByte() functions can be used " \ + "instead. You can define _SILENCE_STDEXT_CVT_DEPRECATION_WARNING or " \ + "_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_STDEXT_CVT +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX17 && !defined(_SILENCE_IO_PFX_SFX_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS) +#define _DEPRECATE_IO_PFX_SFX \ + [[deprecated( \ + "warning STL4045: The ipfx(), isfx(), opfx(), and osfx() functions are removed before C++98 (see WG21-N0794) " \ + "but kept as non-Standard extensions. They will be removed in the future, and the member classes sentry " \ + "should be used instead. You can define _SILENCE_IO_PFX_SFX_DEPRECATION_WARNING or " \ + "_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_IO_PFX_SFX +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX17 && !defined(_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) \ + && !defined(_SILENCE_TR1_RANDOM_DEPRECATION_WARNING) && !defined(_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS) +#define _DEPRECATE_TR1_RANDOM \ + [[deprecated("warning STL4046: Non-Standard TR1 components in are deprecated and will be REMOVED. You " \ + "can define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING, _SILENCE_TR1_RANDOM_DEPRECATION_WARNING, or " \ + "_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _DEPRECATE_TR1_RANDOM +#endif // ^^^ warning disabled ^^^ + +// next warning number: STL4047 + +// next error number: STL1006 + +// P0619R4 Removing C++17-Deprecated Features +#ifndef _HAS_FEATURES_REMOVED_IN_CXX20 +#define _HAS_FEATURES_REMOVED_IN_CXX20 (!_HAS_CXX20) +#endif // !defined(_HAS_FEATURES_REMOVED_IN_CXX20) + +#ifndef _HAS_DEPRECATED_ADAPTOR_TYPEDEFS +#define _HAS_DEPRECATED_ADAPTOR_TYPEDEFS (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_ADAPTOR_TYPEDEFS) + +#ifndef _HAS_DEPRECATED_ALLOCATOR_MEMBERS +#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_ALLOCATOR_MEMBERS) + +#ifndef _HAS_DEPRECATED_ALLOCATOR_VOID +#define _HAS_DEPRECATED_ALLOCATOR_VOID (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_ALLOCATOR_VOID) + +#ifndef _HAS_DEPRECATED_IS_LITERAL_TYPE +#define _HAS_DEPRECATED_IS_LITERAL_TYPE (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_IS_LITERAL_TYPE) + +#ifndef _HAS_DEPRECATED_NEGATORS +#define _HAS_DEPRECATED_NEGATORS (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_NEGATORS) + +#ifndef _HAS_DEPRECATED_RAW_STORAGE_ITERATOR +#define _HAS_DEPRECATED_RAW_STORAGE_ITERATOR (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_RAW_STORAGE_ITERATOR) + +#ifndef _HAS_DEPRECATED_RESULT_OF +#define _HAS_DEPRECATED_RESULT_OF (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_RESULT_OF) + +#ifndef _HAS_DEPRECATED_SHARED_PTR_UNIQUE +#define _HAS_DEPRECATED_SHARED_PTR_UNIQUE (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_SHARED_PTR_UNIQUE) + +#ifndef _HAS_DEPRECATED_TEMPORARY_BUFFER +#define _HAS_DEPRECATED_TEMPORARY_BUFFER (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_TEMPORARY_BUFFER) + +#ifndef _HAS_DEPRECATED_UNCAUGHT_EXCEPTION +#define _HAS_DEPRECATED_UNCAUGHT_EXCEPTION (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_DEPRECATED_UNCAUGHT_EXCEPTION) + +#if _HAS_DEPRECATED_ADAPTOR_TYPEDEFS +#define _ARGUMENT_TYPE_NAME argument_type +#define _FIRST_ARGUMENT_TYPE_NAME first_argument_type +#define _SECOND_ARGUMENT_TYPE_NAME second_argument_type +#define _RESULT_TYPE_NAME result_type +#else // ^^^ _HAS_DEPRECATED_ADAPTOR_TYPEDEFS / !_HAS_DEPRECATED_ADAPTOR_TYPEDEFS vvv +#define _ARGUMENT_TYPE_NAME _Unnameable_argument +#define _FIRST_ARGUMENT_TYPE_NAME _Unnameable_first_argument +#define _SECOND_ARGUMENT_TYPE_NAME _Unnameable_second_argument +#define _RESULT_TYPE_NAME _Unnameable_result +#endif // ^^^ !_HAS_DEPRECATED_ADAPTOR_TYPEDEFS ^^^ + +// P1423R3 char8_t Backward Compatibility Remediation +// Controls whether we allow the stream insertions this proposal forbids +#ifndef _HAS_STREAM_INSERTION_OPERATORS_DELETED_IN_CXX20 +#define _HAS_STREAM_INSERTION_OPERATORS_DELETED_IN_CXX20 (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // !defined(_HAS_STREAM_INSERTION_OPERATORS_DELETED_IN_CXX20) + +#ifndef _HAS_FEATURES_REMOVED_IN_CXX23 +#define _HAS_FEATURES_REMOVED_IN_CXX23 (!_HAS_CXX23) +#endif // !defined(_HAS_FEATURES_REMOVED_IN_CXX23) + +// P2186R2 Removing Garbage Collection Support +#ifndef _HAS_GARBAGE_COLLECTION_SUPPORT_DELETED_IN_CXX23 +#define _HAS_GARBAGE_COLLECTION_SUPPORT_DELETED_IN_CXX23 (_HAS_FEATURES_REMOVED_IN_CXX23) +#endif // !defined(_HAS_GARBAGE_COLLECTION_SUPPORT_DELETED_IN_CXX23) + +// C++14 +#define __cpp_lib_chrono_udls 201304L +#define __cpp_lib_complex_udls 201309L +#define __cpp_lib_exchange_function 201304L +#define __cpp_lib_freestanding_char_traits 202306L +#define __cpp_lib_freestanding_cstdlib 202306L +#define __cpp_lib_freestanding_cstring 202311L +#define __cpp_lib_freestanding_cwchar 202306L +#define __cpp_lib_freestanding_errc 202306L +#define __cpp_lib_freestanding_feature_test_macros 202306L +#define __cpp_lib_freestanding_functional 202306L +#define __cpp_lib_freestanding_iterator 202306L +#define __cpp_lib_freestanding_memory 202306L +#define __cpp_lib_freestanding_operator_new 202306L +#define __cpp_lib_freestanding_ratio 202306L +#define __cpp_lib_freestanding_tuple 202306L +#define __cpp_lib_freestanding_utility 202306L +#define __cpp_lib_generic_associative_lookup 201304L +#define __cpp_lib_integer_sequence 201304L +#define __cpp_lib_integral_constant_callable 201304L +#define __cpp_lib_is_final 201402L +#define __cpp_lib_is_null_pointer 201309L +#define __cpp_lib_make_reverse_iterator 201402L +#define __cpp_lib_make_unique 201304L +#define __cpp_lib_null_iterators 201304L +#define __cpp_lib_quoted_string_io 201304L +#define __cpp_lib_result_of_sfinae 201210L +#define __cpp_lib_robust_nonmodifying_seq_ops 201304L +#ifndef _M_CEE_PURE +#define __cpp_lib_shared_timed_mutex 201402L +#endif // !defined(_M_CEE_PURE) +#define __cpp_lib_string_udls 201304L +#define __cpp_lib_transformation_trait_aliases 201304L +#define __cpp_lib_tuple_element_t 201402L +#define __cpp_lib_tuples_by_type 201304L + +// C++17 +#define __cpp_lib_addressof_constexpr 201603L +#define __cpp_lib_allocator_traits_is_always_equal 201411L +#define __cpp_lib_as_const 201510L +#define __cpp_lib_bool_constant 201505L +#define __cpp_lib_enable_shared_from_this 201603L +#define __cpp_lib_incomplete_container_elements 201505L +#define __cpp_lib_invoke 201411L +#define __cpp_lib_logical_traits 201510L +#define __cpp_lib_map_try_emplace 201411L +#define __cpp_lib_nonmember_container_access 201411L +#define __cpp_lib_shared_mutex 201505L +#define __cpp_lib_transparent_operators 201510L +#define __cpp_lib_type_trait_variable_templates 201510L +#define __cpp_lib_uncaught_exceptions 201411L +#define __cpp_lib_unordered_map_try_emplace 201411L +#define __cpp_lib_void_t 201411L + +#if _HAS_CXX17 +#if _HAS_STATIC_RTTI +#define __cpp_lib_any 201606L +#endif // _HAS_STATIC_RTTI +#define __cpp_lib_apply 201603L +#define __cpp_lib_atomic_is_always_lock_free 201603L +#define __cpp_lib_boyer_moore_searcher 201603L +#if _HAS_STD_BYTE +#define __cpp_lib_byte 201603L +#endif // _HAS_STD_BYTE +#define __cpp_lib_clamp 201603L +#define __cpp_lib_filesystem 201703L +#define __cpp_lib_freestanding_charconv 202306L +#define __cpp_lib_gcd_lcm 201606L +#define __cpp_lib_hardware_interference_size 201703L +#define __cpp_lib_has_unique_object_representations 201606L +#define __cpp_lib_hypot 201603L +#define __cpp_lib_is_aggregate 201703L +#define __cpp_lib_is_invocable 201703L +#define __cpp_lib_is_swappable 201603L +#define __cpp_lib_launder 201606L +#define __cpp_lib_make_from_tuple 201606L +#define __cpp_lib_math_special_functions 201603L +#define __cpp_lib_memory_resource 201603L +#define __cpp_lib_node_extract 201606L +#define __cpp_lib_not_fn 201603L +#ifndef _M_CEE_PURE +#define __cpp_lib_parallel_algorithm 201603L +#endif // !defined(_M_CEE_PURE) +#define __cpp_lib_raw_memory_algorithms 201606L +#define __cpp_lib_sample 201603L +#define __cpp_lib_scoped_lock 201703L +#define __cpp_lib_shared_ptr_weak_type 201606L +#define __cpp_lib_string_view 201803L +#define __cpp_lib_to_chars 201611L +#endif // _HAS_CXX17 + +// C++20 +#define __cpp_lib_atomic_value_initialization 201911L + +#ifdef __cpp_char8_t +#define __cpp_lib_char8_t 201907L +#endif // defined(__cpp_char8_t) + +#ifdef __cpp_impl_coroutine +#define __cpp_lib_coroutine 201902L +#endif // defined(__cpp_impl_coroutine) + +#if _HAS_CXX20 +#define __cpp_lib_algorithm_iterator_requirements 202207L +#define __cpp_lib_assume_aligned 201811L +#define __cpp_lib_atomic_flag_test 201907L +#define __cpp_lib_atomic_float 201711L +#define __cpp_lib_atomic_lock_free_type_aliases 201907L +#define __cpp_lib_atomic_ref 201806L +#define __cpp_lib_atomic_shared_ptr 201711L +#define __cpp_lib_atomic_wait 201907L +#define __cpp_lib_barrier 202302L +#define __cpp_lib_bind_front 201907L +#define __cpp_lib_bit_cast 201806L +#define __cpp_lib_bitops 201907L +#define __cpp_lib_bounded_array_traits 201902L +#define __cpp_lib_common_reference 202302L +#define __cpp_lib_common_reference_wrapper 202302L +#define __cpp_lib_constexpr_algorithms 201806L +#define __cpp_lib_constexpr_complex 201711L +#define __cpp_lib_constexpr_dynamic_alloc 201907L +#define __cpp_lib_constexpr_functional 201907L +#define __cpp_lib_constexpr_iterator 201811L +#define __cpp_lib_constexpr_numeric 201911L +#define __cpp_lib_constexpr_string 201907L +#define __cpp_lib_constexpr_string_view 201811L +#define __cpp_lib_constexpr_tuple 201811L +#define __cpp_lib_constexpr_utility 201811L +#define __cpp_lib_constexpr_vector 201907L +#define __cpp_lib_destroying_delete 201806L +#define __cpp_lib_endian 201907L +#define __cpp_lib_erase_if 202002L +#define __cpp_lib_format 202304L +#define __cpp_lib_format_uchar 202311L +#define __cpp_lib_freestanding_ranges 202306L +#define __cpp_lib_generic_unordered_lookup 201811L +#define __cpp_lib_int_pow2 202002L +#define __cpp_lib_integer_comparison_functions 202002L +#define __cpp_lib_interpolate 201902L +#define __cpp_lib_is_constant_evaluated 201811L + +#ifndef __clang__ // TRANSITION, LLVM-48860 +#define __cpp_lib_is_layout_compatible 201907L +#endif // ^^^ no workaround ^^^ + +#define __cpp_lib_is_nothrow_convertible 201806L + +#ifndef __clang__ // TRANSITION, LLVM-48860 +#define __cpp_lib_is_pointer_interconvertible 201907L +#endif // ^^^ no workaround ^^^ + +#define __cpp_lib_jthread 201911L +#define __cpp_lib_latch 201907L +#define __cpp_lib_list_remove_return_type 201806L +#define __cpp_lib_math_constants 201907L + +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, Clang and EDG support for modules +#define __cpp_lib_modules 202207L +#endif // ^^^ no workaround ^^^ + +#define __cpp_lib_move_iterator_concept 202207L +#define __cpp_lib_polymorphic_allocator 201902L +#define __cpp_lib_remove_cvref 201711L +#define __cpp_lib_semaphore 201907L +#define __cpp_lib_smart_ptr_for_overwrite 202002L +#define __cpp_lib_source_location 201907L +#define __cpp_lib_span 202002L +#define __cpp_lib_ssize 201902L +#define __cpp_lib_starts_ends_with 201711L +#define __cpp_lib_syncbuf 201803L +#define __cpp_lib_three_way_comparison 201907L +#define __cpp_lib_to_address 201711L +#define __cpp_lib_to_array 201907L +#define __cpp_lib_type_identity 201806L +#define __cpp_lib_unwrap_ref 201811L +#endif // _HAS_CXX20 + +// C++23 +#if _HAS_CXX23 +#define __cpp_lib_adaptor_iterator_pair_constructor 202106L +#define __cpp_lib_allocate_at_least 202302L +#define __cpp_lib_associative_heterogeneous_erasure 202110L +#define __cpp_lib_bind_back 202202L +#define __cpp_lib_byteswap 202110L +#define __cpp_lib_constexpr_bitset 202207L +#define __cpp_lib_constexpr_charconv 202207L +#define __cpp_lib_constexpr_typeinfo 202106L +#define __cpp_lib_containers_ranges 202202L +#define __cpp_lib_expected 202211L +#define __cpp_lib_formatters 202302L +#define __cpp_lib_forward_like 202207L +#define __cpp_lib_invoke_r 202106L +#define __cpp_lib_ios_noreplace 202207L +#define __cpp_lib_is_scoped_enum 202011L +#define __cpp_lib_mdspan 202207L +#define __cpp_lib_move_only_function 202110L +#define __cpp_lib_out_ptr 202106L +#define __cpp_lib_print 202207L +#define __cpp_lib_ranges_as_const 202311L +#define __cpp_lib_ranges_as_rvalue 202207L +#define __cpp_lib_ranges_cartesian_product 202207L +#define __cpp_lib_ranges_chunk 202202L +#define __cpp_lib_ranges_chunk_by 202202L +#define __cpp_lib_ranges_contains 202207L +#define __cpp_lib_ranges_enumerate 202302L +#define __cpp_lib_ranges_find_last 202207L +#define __cpp_lib_ranges_fold 202207L +#define __cpp_lib_ranges_iota 202202L +#define __cpp_lib_ranges_join_with 202202L +#define __cpp_lib_ranges_repeat 202207L +#define __cpp_lib_ranges_slide 202202L +#define __cpp_lib_ranges_starts_ends_with 202106L +#define __cpp_lib_ranges_stride 202207L +#define __cpp_lib_ranges_to_container 202202L +#define __cpp_lib_ranges_zip 202110L +#define __cpp_lib_spanstream 202106L +#define __cpp_lib_stacktrace 202011L +#define __cpp_lib_stdatomic_h 202011L +#define __cpp_lib_string_contains 202011L +#define __cpp_lib_string_resize_and_overwrite 202110L +#define __cpp_lib_to_underlying 202102L +#define __cpp_lib_tuple_like 202207L +#define __cpp_lib_unreachable 202202L +#endif // _HAS_CXX23 + +// macros with language mode sensitivity +#if _HAS_CXX20 +#define __cpp_lib_array_constexpr 201811L // P1032R1 Miscellaneous constexpr +#elif _HAS_CXX17 +#define __cpp_lib_array_constexpr 201803L // P0858R0 Constexpr Iterator Requirements +#endif + +#if _HAS_CXX20 +#define __cpp_lib_chrono 201907L // P1466R3 Miscellaneous Minor Fixes For +#elif _HAS_CXX17 +#define __cpp_lib_chrono 201611L // P0505R0 constexpr For (Again) +#else +#define __cpp_lib_chrono 201510L // P0092R1 floor(), ceil(), round(), abs() +#endif + +#if _HAS_CXX23 +#define __cpp_lib_concepts 202207L // P2404R3 Move-Only Types For Comparison Concepts +#elif _HAS_CXX20 +#define __cpp_lib_concepts 202002L // P1964R2 Replacing boolean With boolean-testable +#endif + +#if _HAS_CXX23 +#define __cpp_lib_constexpr_memory 202202L // P2273R3 constexpr unique_ptr +#elif _HAS_CXX20 +#define __cpp_lib_constexpr_memory 201811L // P1006R1 constexpr For pointer_traits::pointer_to() +#endif + +#ifndef _M_CEE_PURE +#if _HAS_CXX20 +#define __cpp_lib_execution 201902L // P1001R2 execution::unseq +#elif _HAS_CXX17 +#define __cpp_lib_execution 201603L // P0024R2 Parallel Algorithms +#endif // language mode +#endif // !defined(_M_CEE_PURE) + +#if _HAS_CXX23 +#define __cpp_lib_optional 202110L // P0798R8 Monadic Operations For optional +#elif _HAS_CXX20 +#define __cpp_lib_optional 202106L // P2231R1 Completing constexpr In optional And variant +#elif _HAS_CXX17 +#define __cpp_lib_optional 201606L // P0307R2 Making Optional Greater Equal Again +#endif + +#if _HAS_CXX23 +#define __cpp_lib_ranges 202302L // P2609R3 Relaxing Ranges Just A Smidge +#elif _HAS_CXX20 +#define __cpp_lib_ranges 202110L // P2415R2 What Is A view? +#endif + +#if _HAS_CXX20 +#define __cpp_lib_shared_ptr_arrays 201707L // P0674R1 make_shared() For Arrays +#else +#define __cpp_lib_shared_ptr_arrays 201611L // P0497R0 Fixing shared_ptr For Arrays +#endif + +#if _HAS_CXX23 +#define __cpp_lib_shift 202202L // P2440R1 ranges::shift_left, ranges::shift_right +#elif _HAS_CXX20 +#define __cpp_lib_shift 201806L // P0769R2 shift_left(), shift_right() +#endif + +#if _HAS_CXX20 +#define __cpp_lib_variant 202106L // P2231R1 Completing constexpr In optional And variant +#elif _HAS_CXX17 +#define __cpp_lib_variant 202102L // P2162R2 Inheriting From variant +#endif + +#define __cpp_lib_experimental_erase_if 201411L +#define __cpp_lib_experimental_filesystem 201406L + +#ifdef _RTC_CONVERSION_CHECKS_ENABLED +#ifndef _ALLOW_RTCc_IN_STL +#error /RTCc rejects conformant code, so it is not supported by the C++ Standard Library. Either remove this \ +compiler option, or define _ALLOW_RTCc_IN_STL to suppress this error. +#endif // !defined(_ALLOW_RTCc_IN_STL) +#endif // defined(_RTC_CONVERSION_CHECKS_ENABLED) + +#define _EMPTY_ARGUMENT // for empty macro argument + +// extern "C++" attaches declarations to the global module, see N4964 [module.unit]/7.2. +// It has no effect in C++14/17. + +// In the STL's headers (which might be used to build the named module std), we unconditionally +// and directly mark declarations of our separately compiled machinery as extern "C++", allowing +// the named module to work with the separately compiled code (which is always built classically). + +// TRANSITION: _USE_EXTERN_CXX_EVERYWHERE_FOR_STL controls whether we also wrap the STL's +// header-only code in this linkage-specification, as a temporary workaround to allow +// importing the named module in a translation unit with classic includes. + +#ifndef _USE_EXTERN_CXX_EVERYWHERE_FOR_STL +#define _USE_EXTERN_CXX_EVERYWHERE_FOR_STL _HAS_CXX20 +#endif // ^^^ !defined(_USE_EXTERN_CXX_EVERYWHERE_FOR_STL) ^^^ + +#if _USE_EXTERN_CXX_EVERYWHERE_FOR_STL +#define _EXTERN_CXX_WORKAROUND extern "C++" { +#define _END_EXTERN_CXX_WORKAROUND } +#else // ^^^ _USE_EXTERN_CXX_EVERYWHERE_FOR_STL / !_USE_EXTERN_CXX_EVERYWHERE_FOR_STL vvv +#define _EXTERN_CXX_WORKAROUND +#define _END_EXTERN_CXX_WORKAROUND +#endif // ^^^ !_USE_EXTERN_CXX_EVERYWHERE_FOR_STL ^^^ + +#define _STD_BEGIN \ + _EXTERN_CXX_WORKAROUND \ + namespace std { +#define _STD_END \ + } \ + _END_EXTERN_CXX_WORKAROUND + +#define _STD ::std:: +#define _CHRONO ::std::chrono:: +#define _RANGES ::std::ranges:: + +// We use the stdext (standard extension) namespace to contain non-standard extensions +#pragma push_macro("stdext") +#undef stdext +#define _STDEXT_BEGIN \ + _EXTERN_CXX_WORKAROUND \ + namespace stdext { +#define _STDEXT_END \ + } \ + _END_EXTERN_CXX_WORKAROUND + +#define _STDEXT ::stdext:: +#pragma pop_macro("stdext") + +#define _CSTD :: + +#ifdef _M_CEE_PURE +#define _EXTERN_C_UNLESS_PURE +#define _END_EXTERN_C_UNLESS_PURE +#else // ^^^ defined(_M_CEE_PURE) / !defined(_M_CEE_PURE) vvv +#define _EXTERN_C_UNLESS_PURE extern "C" { +#define _END_EXTERN_C_UNLESS_PURE } // extern "C" +#endif // ^^^ !defined(_M_CEE_PURE) ^^^ + +#if defined(MRTDLL) && !defined(_CRTBLD) +#error In yvals_core.h, defined(MRTDLL) implies defined(_CRTBLD); !defined(_CRTBLD) implies !defined(MRTDLL) +#endif // defined(MRTDLL) && !defined(_CRTBLD) + +#if defined(MRTDLL) && !defined(_M_CEE_PURE) +#error In yvals_core.h, defined(MRTDLL) implies defined(_M_CEE_PURE); !defined(_M_CEE_PURE) implies !defined(MRTDLL) +#endif // defined(MRTDLL) && !defined(_M_CEE_PURE) + +#define _STL_WIN32_WINNT_VISTA 0x0600 // _WIN32_WINNT_VISTA from sdkddkver.h +#define _STL_WIN32_WINNT_WIN7 0x0601 // _WIN32_WINNT_WIN7 from sdkddkver.h +#define _STL_WIN32_WINNT_WIN8 0x0602 // _WIN32_WINNT_WIN8 from sdkddkver.h +#define _STL_WIN32_WINNT_WINBLUE 0x0603 // _WIN32_WINNT_WINBLUE from sdkddkver.h +#define _STL_WIN32_WINNT_WIN10 0x0A00 // _WIN32_WINNT_WIN10 from sdkddkver.h + +// Note that the STL DLL builds will set this to XP for ABI compatibility with VS2015 which supported XP. +#ifndef _STL_WIN32_WINNT +#if defined(_M_ARM64) +// The first ARM64 Windows was Windows 10 +#define _STL_WIN32_WINNT _STL_WIN32_WINNT_WIN10 +#elif defined(_M_ARM) || defined(_ONECORE) || defined(_CRT_APP) +// The first ARM or OneCore or App Windows was Windows 8 +#define _STL_WIN32_WINNT _STL_WIN32_WINNT_WIN8 +#else // ^^^ default to Win8 / default to Win7 vvv +// The earliest Windows supported by this implementation is Windows 7 +#define _STL_WIN32_WINNT _STL_WIN32_WINNT_WIN7 +#endif // ^^^ !defined(_M_ARM) && !defined(_M_ARM64) && !defined(_ONECORE) && !defined(_CRT_APP) ^^^ +#endif // !defined(_STL_WIN32_WINNT) + +#ifdef __cpp_noexcept_function_type +#define _NOEXCEPT_FNPTR noexcept +#else // ^^^ defined(__cpp_noexcept_function_type) / !defined(__cpp_noexcept_function_type) vvv +#define _NOEXCEPT_FNPTR +#endif // ^^^ !defined(__cpp_noexcept_function_type) ^^^ + +#ifdef __clang__ +#define _STL_INTRIN_HEADER +#define _STL_UNREACHABLE __builtin_unreachable() +#else // ^^^ defined(__clang__) / !defined(__clang__) vvv +#define _STL_INTRIN_HEADER +#define _STL_UNREACHABLE __assume(false) +#endif // ^^^ !defined(__clang__) ^^^ + +#ifdef _ENABLE_STL_INTERNAL_CHECK +#define _STL_INTERNAL_STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) +#else // ^^^ defined(_ENABLE_STL_INTERNAL_CHECK) / !defined(_ENABLE_STL_INTERNAL_CHECK) vvv +#define _STL_INTERNAL_STATIC_ASSERT(...) +#endif // ^^^ !defined(_ENABLE_STL_INTERNAL_CHECK) ^^^ + +#ifdef __cpp_static_call_operator +#define _STATIC_CALL_OPERATOR static +#define _CONST_CALL_OPERATOR +#else // ^^^ defined(__cpp_static_call_operator) / !defined(__cpp_static_call_operator) vvv +#define _STATIC_CALL_OPERATOR +#define _CONST_CALL_OPERATOR const +#endif // ^^^ !defined(__cpp_static_call_operator) ^^^ + +#endif // _STL_COMPILER_PREPROCESSOR + +#endif // defined(_WIN32) +#endif // _YVALS_CORE_H_ diff --git a/Sources/OneTBB/include/OneTBB/oneapi/tbb/detail/_config.h b/Sources/OneTBB/include/OneTBB/oneapi/tbb/detail/_config.h index 3fd44109..e9c6f668 100644 --- a/Sources/OneTBB/include/OneTBB/oneapi/tbb/detail/_config.h +++ b/Sources/OneTBB/include/OneTBB/oneapi/tbb/detail/_config.h @@ -28,11 +28,15 @@ /* Check which standard library we use. */ #include -#ifdef __has_include -#if __has_include() -#include -#endif -#endif +#if defined(_WIN32) +# include +#else // !defined(_WIN32) +# ifdef __has_include +# if __has_include() +# include +# endif // __has_include() +# endif // __has_include +#endif // defined(_WIN32) #include "_export.h" diff --git a/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/fmt.cc b/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/fmt.cc index d8665c23..a246ff02 100644 --- a/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/fmt.cc +++ b/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/fmt.cc @@ -31,7 +31,12 @@ #include #include #include -#include + +#if defined(_WIN32) +# include +#else // !defined(_WIN32) +# include +#endif // defined(_WIN32) #if __has_include() # include diff --git a/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/std.h b/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/std.h index b4e055c2..ad812933 100644 --- a/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/std.h +++ b/Sources/OpenImageIO/include/OpenImageIO/detail/fmt/std.h @@ -22,9 +22,13 @@ #include "format.h" #include "ostream.h" -#if FMT_HAS_INCLUDE() -# include -#endif +#if defined(_WIN32) +# include +#else // !defined(_WIN32) +# if FMT_HAS_INCLUDE() +# include +# endif // FMT_HAS_INCLUDE() +#endif // defined(_WIN32) // Checking FMT_CPLUSPLUS for warning suppression in MSVC. #if FMT_CPLUSPLUS >= 201703L # if FMT_HAS_INCLUDE() diff --git a/Sources/OpenVDB/Grid.cc b/Sources/OpenVDB/Grid.cc index 1e14cb08..0426dcd0 100644 --- a/Sources/OpenVDB/Grid.cc +++ b/Sources/OpenVDB/Grid.cc @@ -384,8 +384,8 @@ GridBase::addStatsMetadata() this->removeMeta(META_FILE_BBOX_MAX); this->removeMeta(META_FILE_MEM_BYTES); this->removeMeta(META_FILE_VOXEL_COUNT); - this->insertMeta(META_FILE_BBOX_MIN, Vec3IMetadata(bbox.min().asVec3i())); - this->insertMeta(META_FILE_BBOX_MAX, Vec3IMetadata(bbox.max().asVec3i())); + this->insertMeta(META_FILE_BBOX_MIN, Vec3IMetadata((bbox.min)().asVec3i())); + this->insertMeta(META_FILE_BBOX_MAX, Vec3IMetadata((bbox.max)().asVec3i())); this->insertMeta(META_FILE_MEM_BYTES, Int64Metadata(this->memUsage())); this->insertMeta(META_FILE_VOXEL_COUNT, Int64Metadata(this->activeVoxelCount())); } diff --git a/Sources/OpenVDB/include/openvdb/TypeList.h b/Sources/OpenVDB/include/openvdb/TypeList.h index 2f66033e..c786ff65 100644 --- a/Sources/OpenVDB/include/openvdb/TypeList.h +++ b/Sources/OpenVDB/include/openvdb/TypeList.h @@ -16,6 +16,7 @@ #include #include +#include /// We should usually not be decorating public API functions with attributes /// such as always_inline. However many compilers are notoriously bad at diff --git a/Sources/OpenVDB/include/openvdb/Types.h b/Sources/OpenVDB/include/openvdb/Types.h index 26067139..8661c99d 100644 --- a/Sources/OpenVDB/include/openvdb/Types.h +++ b/Sources/OpenVDB/include/openvdb/Types.h @@ -354,13 +354,13 @@ struct PromoteType template using TypeT = typename std::conditional::value, types_internal::int_t::value>, - types_internal::flt_t>::type; + types_internal::flt_t<(std::max)(size_t(16), bits)>>::type; public: static_assert(sizeof(T) <= 8ul, "Unsupported source type for promotion"); #define OPENVDB_TARGET_BITS(SHIFT, PROMOTE) \ - std::max(size_t(8), \ - std::min(size_t(64), (PROMOTE ? size_t(8)*(sizeof(T)<>SHIFT)))) template using Promote = typename TypeT::type; template using Demote = typename TypeT::type; diff --git a/Sources/OpenVDB/include/openvdb/io/io.h b/Sources/OpenVDB/include/openvdb/io/io.h index f0576f86..f6922a96 100644 --- a/Sources/OpenVDB/include/openvdb/io/io.h +++ b/Sources/OpenVDB/include/openvdb/io/io.h @@ -14,11 +14,11 @@ #include #if defined(_WIN32) || defined(__ANDROID__) -#include +#include namespace boost { - using namespace std; + using namespace linb; } #else // !defined(_WIN32) && !defined(__ANDROID__) #include @@ -99,7 +99,11 @@ class OPENVDB_API StreamMetadata const MetaMap& gridMetadata() const; //@} + #if !defined(_WIN32) using AuxDataMap = std::map; + #else // defined(_WIN32) + using AuxDataMap = std::map; + #endif // defined(_WIN32) //@{ /// @brief Return a map that can be populated with arbitrary user data. AuxDataMap& auxData(); diff --git a/Sources/OpenVDB/include/openvdb/math/BBox.h b/Sources/OpenVDB/include/openvdb/math/BBox.h index b2e8d70e..97870193 100644 --- a/Sources/OpenVDB/include/openvdb/math/BBox.h +++ b/Sources/OpenVDB/include/openvdb/math/BBox.h @@ -59,13 +59,13 @@ class BBox void sort(); /// @brief Return a const reference to the minimum point of this bounding box. - const Vec3T& min() const { return mMin; } + const Vec3T& (min)() const { return mMin; } /// @brief Return a const reference to the maximum point of this bounding box. - const Vec3T& max() const { return mMax; } + const Vec3T& (max)() const { return mMax; } /// @brief Return a non-const reference to the minimum point of this bounding box. - Vec3T& min() { return mMin; } + Vec3T& (min)() { return mMin; } /// @brief Return a non-const reference to the maximum point of this bounding box. - Vec3T& max() { return mMax; } + Vec3T& (max)() { return mMax; } /// @brief Return @c true if this bounding box is identical to the given bounding box. bool operator==(const BBox& rhs) const; @@ -146,8 +146,8 @@ class BBox template inline BBox::BBox(): - mMin( std::numeric_limits::max()), - mMax(-std::numeric_limits::max()) + mMin( (std::numeric_limits::max)()), + mMax(-(std::numeric_limits::max)()) { } @@ -208,9 +208,9 @@ inline bool BBox::operator==(const BBox& rhs) const { if (std::is_integral::value) { - return mMin == rhs.min() && mMax == rhs.max(); + return mMin == (rhs.min)() && mMax == (rhs.max)(); } else { - return math::isApproxEqual(mMin, rhs.min()) && math::isApproxEqual(mMax, rhs.max()); + return math::isApproxEqual(mMin, (rhs.min)()) && math::isApproxEqual(mMax, (rhs.max)()); } } @@ -221,8 +221,8 @@ BBox::sort() { Vec3T tMin(mMin), tMax(mMax); for (int i = 0; i < 3; ++i) { - mMin[i] = std::min(tMin[i], tMax[i]); - mMax[i] = std::max(tMin[i], tMax[i]); + mMin[i] = (std::min)(tMin[i], tMax[i]); + mMax[i] = (std::max)(tMin[i], tMax[i]); } } @@ -284,14 +284,14 @@ inline bool BBox::isInside(const BBox& b) const { if (std::is_integral::value) { - return b.min()[0] >= mMin[0] && b.max()[0] <= mMax[0] && - b.min()[1] >= mMin[1] && b.max()[1] <= mMax[1] && - b.min()[2] >= mMin[2] && b.max()[2] <= mMax[2]; + return (b.min)()[0] >= mMin[0] && (b.max)()[0] <= mMax[0] && + (b.min)()[1] >= mMin[1] && (b.max)()[1] <= mMax[1] && + (b.min)()[2] >= mMin[2] && (b.max)()[2] <= mMax[2]; } else { ElementType t = math::Tolerance::value(); - return (b.min()[0]-t) > mMin[0] && (b.max()[0]+t) < mMax[0] && - (b.min()[1]-t) > mMin[1] && (b.max()[1]+t) < mMax[1] && - (b.min()[2]-t) > mMin[2] && (b.max()[2]+t) < mMax[2]; + return ((b.min)()[0]-t) > mMin[0] && ((b.max)()[0]+t) < mMax[0] && + ((b.min)()[1]-t) > mMin[1] && ((b.max)()[1]+t) < mMax[1] && + ((b.min)()[2]-t) > mMin[2] && ((b.max)()[2]+t) < mMax[2]; } } @@ -301,14 +301,14 @@ inline bool BBox::hasOverlap(const BBox& b) const { if (std::is_integral::value) { - return mMax[0] >= b.min()[0] && mMin[0] <= b.max()[0] && - mMax[1] >= b.min()[1] && mMin[1] <= b.max()[1] && - mMax[2] >= b.min()[2] && mMin[2] <= b.max()[2]; + return mMax[0] >= (b.min)()[0] && mMin[0] <= (b.max)()[0] && + mMax[1] >= (b.min)()[1] && mMin[1] <= (b.max)()[1] && + mMax[2] >= (b.min)()[2] && mMin[2] <= (b.max)()[2]; } else { ElementType t = math::Tolerance::value(); - return mMax[0] > (b.min()[0]-t) && mMin[0] < (b.max()[0]+t) && - mMax[1] > (b.min()[1]-t) && mMin[1] < (b.max()[1]+t) && - mMax[2] > (b.min()[2]-t) && mMin[2] < (b.max()[2]+t); + return mMax[0] > ((b.min)()[0]-t) && mMin[0] < ((b.max)()[0]+t) && + mMax[1] > ((b.min)()[1]-t) && mMin[1] < ((b.max)()[1]+t) && + mMax[2] > ((b.min)()[2]-t) && mMin[2] < ((b.max)()[2]+t); } } @@ -333,8 +333,8 @@ inline void BBox::expand(const Vec3T& xyz) { for (int i = 0; i < 3; ++i) { - mMin[i] = std::min(mMin[i], xyz[i]); - mMax[i] = std::max(mMax[i], xyz[i]); + mMin[i] = (std::min)(mMin[i], xyz[i]); + mMax[i] = (std::max)(mMax[i], xyz[i]); } } @@ -344,8 +344,8 @@ inline void BBox::expand(const BBox& b) { for (int i = 0; i < 3; ++i) { - mMin[i] = std::min(mMin[i], b.min()[i]); - mMax[i] = std::max(mMax[i], b.max()[i]); + mMin[i] = (std::min)(mMin[i], (b.min)()[i]); + mMax[i] = (std::max)(mMax[i], (b.max)()[i]); } } @@ -355,8 +355,8 @@ BBox::expand(const Vec3T& xyzMin, const ElementType& length) { const ElementType size = std::is_integral::value ? length-1 : length; for (int i = 0; i < 3; ++i) { - mMin[i] = std::min(mMin[i], xyzMin[i]); - mMax[i] = std::max(mMax[i], xyzMin[i] + size); + mMin[i] = (std::min)(mMin[i], xyzMin[i]); + mMax[i] = (std::max)(mMax[i], xyzMin[i] + size); } } @@ -412,7 +412,7 @@ template inline std::ostream& operator<<(std::ostream& os, const BBox& b) { - os << b.min() << " -> " << b.max(); + os << (b.min)() << " -> " << (b.max)(); return os; } diff --git a/Sources/OpenVDB/include/openvdb/math/ConjGradient.h b/Sources/OpenVDB/include/openvdb/math/ConjGradient.h index 6cf22082..0b0e08c2 100644 --- a/Sources/OpenVDB/include/openvdb/math/ConjGradient.h +++ b/Sources/OpenVDB/include/openvdb/math/ConjGradient.h @@ -1156,7 +1156,7 @@ SparseStencilMatrix::RowBase::dot( const VecValueType* inVec, SizeType vecSize) const { VecValueType result = zeroVal(); - for (SizeType idx = 0, N = std::min(vecSize, this->size()); idx < N; ++idx) { + for (SizeType idx = 0, N = (std::min)(vecSize, this->size()); idx < N; ++idx) { result += static_cast(this->value(idx) * inVec[this->column(idx)]); } return result; @@ -1679,7 +1679,7 @@ solve( ValueType rDotZPrev(1); // inner product of // Keep track of the minimum error to monitor convergence. - ValueType minL2Error = std::numeric_limits::max(); + ValueType minL2Error = (std::numeric_limits::max)(); ValueType l2Error; int iteration = 0; diff --git a/Sources/OpenVDB/include/openvdb/math/Coord.h b/Sources/OpenVDB/include/openvdb/math/Coord.h index 87433d8e..fab80cea 100644 --- a/Sources/OpenVDB/include/openvdb/math/Coord.h +++ b/Sources/OpenVDB/include/openvdb/math/Coord.h @@ -40,10 +40,10 @@ class Coord explicit Coord(const Int32* v): mVec{{v[0], v[1], v[2]}} {} /// @brief Return the smallest possible coordinate - static Coord min() { return Coord(Limits::min()); } + static Coord (min)() { return Coord((Limits::min)()); } /// @brief Return the largest possible coordinate - static Coord max() { return Coord(Limits::max()); } + static Coord (max)() { return Coord((Limits::max)()); } /// @brief Return @a xyz rounded to the closest integer coordinates /// (cell centered conversion). @@ -174,33 +174,33 @@ class Coord /// Perform a component-wise minimum with the other Coord. void minComponent(const Coord& other) { - mVec[0] = std::min(mVec[0], other.mVec[0]); - mVec[1] = std::min(mVec[1], other.mVec[1]); - mVec[2] = std::min(mVec[2], other.mVec[2]); + mVec[0] = (std::min)(mVec[0], other.mVec[0]); + mVec[1] = (std::min)(mVec[1], other.mVec[1]); + mVec[2] = (std::min)(mVec[2], other.mVec[2]); } /// Perform a component-wise maximum with the other Coord. void maxComponent(const Coord& other) { - mVec[0] = std::max(mVec[0], other.mVec[0]); - mVec[1] = std::max(mVec[1], other.mVec[1]); - mVec[2] = std::max(mVec[2], other.mVec[2]); + mVec[0] = (std::max)(mVec[0], other.mVec[0]); + mVec[1] = (std::max)(mVec[1], other.mVec[1]); + mVec[2] = (std::max)(mVec[2], other.mVec[2]); } /// Return the component-wise minimum of the two Coords. static inline Coord minComponent(const Coord& lhs, const Coord& rhs) { - return Coord(std::min(lhs.x(), rhs.x()), - std::min(lhs.y(), rhs.y()), - std::min(lhs.z(), rhs.z())); + return Coord((std::min)(lhs.x(), rhs.x()), + (std::min)(lhs.y(), rhs.y()), + (std::min)(lhs.z(), rhs.z())); } /// Return the component-wise maximum of the two Coords. static inline Coord maxComponent(const Coord& lhs, const Coord& rhs) { - return Coord(std::max(lhs.x(), rhs.x()), - std::max(lhs.y(), rhs.y()), - std::max(lhs.z(), rhs.z())); + return Coord((std::max)(lhs.x(), rhs.x()), + (std::max)(lhs.y(), rhs.y()), + (std::max)(lhs.z(), rhs.z())); } /// Return true if any of the components of @a a are smaller than the @@ -261,7 +261,7 @@ class CoordBBox { public: /// @brief C-tor from a bounding box - Iterator(const CoordBBox& b): mPos(b.min()), mMin(b.min()), mMax(b.max()) {} + Iterator(const CoordBBox& b): mPos((b.min)()), mMin((b.min)()), mMax((b.max)()) {} /// @brief Increment the iterator to point to the next coordinate. /// @details Iteration stops one past the maximum coordinate /// along the axis determined by the template parameter. @@ -293,7 +293,7 @@ class CoordBBox using XYZIterator = Iterator; /// @brief The default constructor produces an empty bounding box. - CoordBBox(): mMin(Coord::max()), mMax(Coord::min()) {} + CoordBBox(): mMin((Coord::max)()), mMax((Coord::min)()) {} /// @brief Construct a bounding box with the given @a min and @a max bounds. CoordBBox(const Coord& min, const Coord& max): mMin(min), mMax(max) {} /// @brief Construct from individual components of the min and max bounds. @@ -318,15 +318,15 @@ class CoordBBox } /// Return an "infinite" bounding box, as defined by the Coord value range. - static CoordBBox inf() { return CoordBBox(Coord::min(), Coord::max()); } + static CoordBBox inf() { return CoordBBox((Coord::min)(), (Coord::max)()); } - const Coord& min() const { return mMin; } - const Coord& max() const { return mMax; } + const Coord& (min)() const { return mMin; } + const Coord& (max)() const { return mMax; } - Coord& min() { return mMin; } - Coord& max() { return mMax; } + Coord& (min)() { return mMin; } + Coord& (max)() { return mMax; } - void reset() { mMin = Coord::max(); mMax = Coord::min(); } + void reset() { mMin = (Coord::max)(); mMax = (Coord::min)(); } void reset(const Coord& min, const Coord& max) { mMin = min; mMax = max; } void resetToCube(const Coord& min, ValueType dim) { mMin = min; mMax = min.offsetBy(dim - 1); } @@ -439,14 +439,14 @@ class CoordBBox /// @brief Union this bounding box with the given bounding box. void expand(const CoordBBox& bbox) { - mMin.minComponent(bbox.min()); - mMax.maxComponent(bbox.max()); + mMin.minComponent((bbox.min)()); + mMax.maxComponent((bbox.max)()); } /// @brief Intersect this bounding box with the given bounding box. void intersect(const CoordBBox& bbox) { - mMin.maxComponent(bbox.min()); - mMax.minComponent(bbox.max()); + mMin.maxComponent((bbox.min)()); + mMax.minComponent((bbox.max)()); } /// @brief Union this bounding box with the cubical bounding box /// of the given size and with the given minimum coordinates. @@ -574,7 +574,7 @@ operator-(const Coord& v1, const Vec3& v0) inline std::ostream& operator<<(std::ostream& os, const CoordBBox& b) { - os << b.min() << " -> " << b.max(); + os << (b.min)() << " -> " << (b.max)(); return os; } diff --git a/Sources/OpenVDB/include/openvdb/math/DDA.h b/Sources/OpenVDB/include/openvdb/math/DDA.h index 908912cf..13fd2d5d 100644 --- a/Sources/OpenVDB/include/openvdb/math/DDA.h +++ b/Sources/OpenVDB/include/openvdb/math/DDA.h @@ -59,8 +59,8 @@ class DDA for (int axis = 0; axis < 3; ++axis) { if (math::isZero(dir[axis])) {//handles dir = +/- 0 mStep[axis] = 0;//dummy value - mNext[axis] = std::numeric_limits::max();//i.e. disabled! - mDelta[axis] = std::numeric_limits::max();//dummy value + mNext[axis] = (std::numeric_limits::max)();//i.e. disabled! + mDelta[axis] = (std::numeric_limits::max)();//dummy value } else if (inv[axis] > 0) { mStep[axis] = DIM; mNext[axis] = mT0 + (mVoxel[axis] + DIM - pos[axis]) * inv[axis]; diff --git a/Sources/OpenVDB/include/openvdb/math/Maps.h b/Sources/OpenVDB/include/openvdb/math/Maps.h index 707ae841..8ab92a19 100644 --- a/Sources/OpenVDB/include/openvdb/math/Maps.h +++ b/Sources/OpenVDB/include/openvdb/math/Maps.h @@ -2112,7 +2112,7 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase // Move the center of the x-face of the bbox // to the origin in index space. Vec3d centered(isloc); - centered = centered - mBBox.min(); + centered = centered - (mBBox.min)(); centered.x() -= mXo; centered.y() -= mYo; @@ -2141,7 +2141,7 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase // Move the center of the x-face of the bbox // to the origin in index space. Vec3d centered(isloc); - centered = centered - mBBox.min(); + centered = centered - (mBBox.min)(); centered.x() -= mXo; centered.y() -= mYo; @@ -2168,7 +2168,7 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase // Move the center of the x-face of the bbox // to the origin in index space. Vec3d centered(isloc); - centered = centered - mBBox.min(); + centered = centered - (mBBox.min)(); centered.x() -= mXo; centered.y() -= mYo; @@ -2325,9 +2325,9 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase /// Return the size of a voxel at the center of the near plane Vec3d voxelSize() const override { - const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()), - 0.5*(mBBox.min().y() + mBBox.max().y()), - mBBox.min().z()); + const Vec3d loc( 0.5*((mBBox.min)().x() + (mBBox.max)().x()), + 0.5*((mBBox.min)().y() + (mBBox.max)().y()), + (mBBox.min)().z()); return voxelSize(loc); @@ -2378,7 +2378,7 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase if (io::getFormatVersion(is) < OPENVDB_FILE_VERSION_FLOAT_FRUSTUM_BBOX ) { CoordBBox bb; bb.read(is); - mBBox = BBoxd(bb.min().asVec3d(), bb.max().asVec3d()); + mBBox = BBoxd((bb.min)().asVec3d(), (bb.max)().asVec3d()); } else { mBBox.read(is); } @@ -2529,7 +2529,7 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase // Move the center of the x-face of the bbox // to the origin in index space. Vec3d out(in); - out = out - mBBox.min(); + out = out - (mBBox.min)(); out.x() -= mXo; out.y() -= mYo; @@ -2559,7 +2559,7 @@ class OPENVDB_API NonlinearFrustumMap final: public MapBase out.z() /= mDepthOnLz; // move back - out = out + mBBox.min(); + out = out + (mBBox.min)(); return out; } diff --git a/Sources/OpenVDB/include/openvdb/math/Mat.h b/Sources/OpenVDB/include/openvdb/math/Mat.h index 5d5bf7fa..dac02b33 100644 --- a/Sources/OpenVDB/include/openvdb/math/Mat.h +++ b/Sources/OpenVDB/include/openvdb/math/Mat.h @@ -119,7 +119,7 @@ class Mat T absMax() const { T x = static_cast(std::fabs(mm[0])); for (unsigned i = 1; i < numElements(); ++i) { - x = std::max(x, static_cast(std::fabs(mm[i]))); + x = (std::max)(x, static_cast(std::fabs(mm[i]))); } return x; } @@ -928,7 +928,7 @@ lInfinityNorm(const MatType& matrix) for (int i = 0; i(seed)), - mRand(std::min(imin, imax), std::max(imin, imax)) + mRand((std::min)(imin, imax), (std::max)(imin, imax)) {} /// Change the range over which integers are distributed to [imin, imax]. void setRange(IntType imin, IntType imax) { - mRand = Distr(std::min(imin, imax), std::max(imin, imax)); + mRand = Distr((std::min)(imin, imax), (std::max)(imin, imax)); } /// Set the seed value for the random number generator @@ -247,7 +247,7 @@ class RandInt /// without changing the current range. IntType operator()(IntType imin, IntType imax) { - const IntType lo = std::min(imin, imax), hi = std::max(imin, imax); + const IntType lo = (std::min)(imin, imax), hi = (std::max)(imin, imax); return mRand(mEngine, typename Distr::param_type(lo, hi)); } }; @@ -596,7 +596,7 @@ template inline const Type& Max(const Type& a, const Type& b) { - return std::max(a,b); + return (std::max)(a,b); } /// Return the maximum of three values @@ -604,7 +604,7 @@ template inline const Type& Max(const Type& a, const Type& b, const Type& c) { - return std::max(std::max(a,b), c); + return (std::max)((std::max)(a,b), c); } /// Return the maximum of four values @@ -612,7 +612,7 @@ template inline const Type& Max(const Type& a, const Type& b, const Type& c, const Type& d) { - return std::max(std::max(a,b), std::max(c,d)); + return (std::max)((std::max)(a,b), (std::max)(c,d)); } /// Return the maximum of five values @@ -620,7 +620,7 @@ template inline const Type& Max(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e) { - return std::max(std::max(a,b), Max(c,d,e)); + return (std::max)((std::max)(a,b), Max(c,d,e)); } /// Return the maximum of six values @@ -628,7 +628,7 @@ template inline const Type& Max(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e, const Type& f) { - return std::max(Max(a,b,c), Max(d,e,f)); + return (std::max)(Max(a,b,c), Max(d,e,f)); } /// Return the maximum of seven values @@ -637,7 +637,7 @@ inline const Type& Max(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e, const Type& f, const Type& g) { - return std::max(Max(a,b,c,d), Max(e,f,g)); + return (std::max)(Max(a,b,c,d), Max(e,f,g)); } /// Return the maximum of eight values @@ -646,7 +646,7 @@ inline const Type& Max(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e, const Type& f, const Type& g, const Type& h) { - return std::max(Max(a,b,c,d), Max(e,f,g,h)); + return (std::max)(Max(a,b,c,d), Max(e,f,g,h)); } @@ -655,19 +655,19 @@ Max(const Type& a, const Type& b, const Type& c, const Type& d, /// Return the minimum of two values template inline const Type& -Min(const Type& a, const Type& b) { return std::min(a, b); } +Min(const Type& a, const Type& b) { return (std::min)(a, b); } /// Return the minimum of three values template inline const Type& -Min(const Type& a, const Type& b, const Type& c) { return std::min(std::min(a, b), c); } +Min(const Type& a, const Type& b, const Type& c) { return (std::min)((std::min)(a, b), c); } /// Return the minimum of four values template inline const Type& Min(const Type& a, const Type& b, const Type& c, const Type& d) { - return std::min(std::min(a, b), std::min(c, d)); + return (std::min)((std::min)(a, b), (std::min)(c, d)); } /// Return the minimum of five values @@ -675,7 +675,7 @@ template inline const Type& Min(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e) { - return std::min(std::min(a,b), Min(c,d,e)); + return (std::min)((std::min)(a,b), Min(c,d,e)); } /// Return the minimum of six values @@ -683,7 +683,7 @@ template inline const Type& Min(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e, const Type& f) { - return std::min(Min(a,b,c), Min(d,e,f)); + return (std::min)(Min(a,b,c), Min(d,e,f)); } /// Return the minimum of seven values @@ -692,7 +692,7 @@ inline const Type& Min(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e, const Type& f, const Type& g) { - return std::min(Min(a,b,c,d), Min(e,f,g)); + return (std::min)(Min(a,b,c,d), Min(e,f,g)); } /// Return the minimum of eight values @@ -701,7 +701,7 @@ inline const Type& Min(const Type& a, const Type& b, const Type& c, const Type& d, const Type& e, const Type& f, const Type& g, const Type& h) { - return std::min(Min(a,b,c,d), Min(e,f,g,h)); + return (std::min)(Min(a,b,c,d), Min(e,f,g,h)); } diff --git a/Sources/OpenVDB/include/openvdb/math/Ray.h b/Sources/OpenVDB/include/openvdb/math/Ray.h index 66cae4a1..9a84c037 100644 --- a/Sources/OpenVDB/include/openvdb/math/Ray.h +++ b/Sources/OpenVDB/include/openvdb/math/Ray.h @@ -56,7 +56,7 @@ class Ray Ray(const Vec3Type& eye = Vec3Type(0,0,0), const Vec3Type& direction = Vec3Type(1,0,0), RealT t0 = math::Delta::value(), - RealT t1 = std::numeric_limits::max()) + RealT t1 = (std::numeric_limits::max)()) : mEye(eye), mDir(direction), mInvDir(1/mDir), mTimeSpan(t0, t1) { } @@ -75,7 +75,7 @@ class Ray inline void setTimes( RealT t0 = math::Delta::value(), - RealT t1 = std::numeric_limits::max()) + RealT t1 = (std::numeric_limits::max)()) { assert(t0>0 && t1>0); mTimeSpan.set(t0, t1); @@ -87,7 +87,7 @@ class Ray const Vec3Type& eye, const Vec3Type& direction, RealT t0 = math::Delta::value(), - RealT t1 = std::numeric_limits::max()) + RealT t1 = (std::numeric_limits::max)()) { this->setEye(eye); this->setDir(direction); @@ -234,8 +234,8 @@ class Ray { mTimeSpan.get(t0, t1); for (int i = 0; i < 3; ++i) { - RealT a = (bbox.min()[i] - mEye[i]) * mInvDir[i]; - RealT b = (bbox.max()[i] - mEye[i]) * mInvDir[i]; + RealT a = ((bbox.min)()[i] - mEye[i]) * mInvDir[i]; + RealT b = ((bbox.max)()[i] - mEye[i]) * mInvDir[i]; if (a > b) std::swap(a, b); if (a > t0) t0 = a; if (b < t1) t1 = b; diff --git a/Sources/OpenVDB/include/openvdb/math/Stats.h b/Sources/OpenVDB/include/openvdb/math/Stats.h index 693af25a..e182dcb5 100644 --- a/Sources/OpenVDB/include/openvdb/math/Stats.h +++ b/Sources/OpenVDB/include/openvdb/math/Stats.h @@ -35,7 +35,7 @@ class MinMax /// @brief Empty constructor /// /// @warning Only use this constructor with POD types - MinMax() : mMin(Limits::max()), mMax(Limits::lowest()) + MinMax() : mMin((Limits::max)()), mMax(Limits::lowest()) { static_assert(std::numeric_limits::is_specialized, "openvdb::math::MinMax default constructor requires a std::numeric_limits specialization"); @@ -53,10 +53,10 @@ class MinMax } /// Return the minimum value. - inline const ValueType& min() const { return mMin; } + inline const ValueType& (min)() const { return mMin; } /// Return the maximum value. - inline const ValueType& max() const { return mMax; } + inline const ValueType& (max)() const { return mMax; } /// Add the samples from the other Stats instance. inline void add(const MinMax& other, const Less &less = Less()) @@ -93,7 +93,7 @@ class Extrema /// @warning The min/max values are initiated to extreme values Extrema() : mSize(0) - , mMin(std::numeric_limits::max()) + , mMin((std::numeric_limits::max)()) , mMax(-mMin) { } @@ -118,10 +118,10 @@ class Extrema inline uint64_t size() const { return mSize; } /// Return the minimum value. - inline double min() const { return mMin; } + inline double (min)() const { return mMin; } /// Return the maximum value. - inline double max() const { return mMax; } + inline double (max)() const { return mMax; } /// Return the range defined as the maximum value minus the minimum value. inline double range() const { return mMax - mMin; } @@ -291,7 +291,7 @@ class Histogram /// @brief Construct with the given bin count and with minimum and maximum values /// taken from a Stats object. Histogram(const Stats& s, size_t numBins = 10): - mSize(0), mMin(s.min()), mMax(s.max()+1e-10), + mSize(0), mMin((s.min)()), mMax((s.max)()+1e-10), mDelta(double(numBins)/(mMax-mMin)), mBins(numBins) { if ( mMax <= mMin ) { @@ -327,13 +327,13 @@ class Histogram /// Return the number of bins in this histogram. inline size_t numBins() const { return mBins.size(); } /// Return the lower bound of this histogram's value range. - inline double min() const { return mMin; } + inline double (min)() const { return mMin; } /// Return the upper bound of this histogram's value range. - inline double max() const { return mMax; } + inline double (max)() const { return mMax; } /// Return the minimum value in the nth bin. - inline double min(int n) const { return mMin+n/mDelta; } + inline double (min)(int n) const { return mMin+n/mDelta; } /// Return the maximum value in the nth bin. - inline double max(int n) const { return mMin+(n+1)/mDelta; } + inline double (max)(int n) const { return mMin+(n+1)/mDelta; } /// Return the number of samples in the nth bin. inline uint64_t count(int n) const { return mBins[n]; } /// Return the population size, i.e., the total number of samples. @@ -354,8 +354,8 @@ class Histogram os << "|| # | Min | Max | Frequency | % ||\n"; os << "==============================================================\n"; for (int i = 0, e = int(mBins.size()); i != e; ++i) { - os << "|| " << std::setw(4) << i << " | " << std::setw(14) << this->min(i) << " | " - << std::setw(14) << this->max(i) << " | " << std::setw(9) << mBins[i] << " | " + os << "|| " << std::setw(4) << i << " | " << std::setw(14) << (this->min)(i) << " | " + << std::setw(14) << (this->max)(i) << " | " << std::setw(9) << mBins[i] << " | " << std::setw(3) << (100*mBins[i]/mSize) << " ||\n"; } os << "==============================================================\n"; diff --git a/Sources/OpenVDB/include/openvdb/math/Stencils.h b/Sources/OpenVDB/include/openvdb/math/Stencils.h index ce6243af..f46fee18 100644 --- a/Sources/OpenVDB/include/openvdb/math/Stencils.h +++ b/Sources/OpenVDB/include/openvdb/math/Stencils.h @@ -150,7 +150,7 @@ class BaseStencil } /// @brief Return the largest value in the stencil buffer. - inline ValueType max() const + inline ValueType (max)() const { const auto iter = std::max_element(mValues.begin(), mValues.end()); return *iter; @@ -212,7 +212,7 @@ class BaseStencil : mGrid(&grid) , mAcc(grid.tree()) , mValues(size) - , mCenter(Coord::max()) + , mCenter((Coord::max)()) { } diff --git a/Sources/OpenVDB/include/openvdb/math/Vec2.h b/Sources/OpenVDB/include/openvdb/math/Vec2.h index 73caa152..eca9f6bb 100644 --- a/Sources/OpenVDB/include/openvdb/math/Vec2.h +++ b/Sources/OpenVDB/include/openvdb/math/Vec2.h @@ -504,8 +504,8 @@ template inline Vec2 minComponent(const Vec2 &v1, const Vec2 &v2) { return Vec2( - std::min(v1.x(), v2.x()), - std::min(v1.y(), v2.y())); + (std::min)(v1.x(), v2.x()), + (std::min)(v1.y(), v2.y())); } /// Return component-wise maximum of the two vectors. @@ -513,8 +513,8 @@ template inline Vec2 maxComponent(const Vec2 &v1, const Vec2 &v2) { return Vec2( - std::max(v1.x(), v2.x()), - std::max(v1.y(), v2.y())); + (std::max)(v1.x(), v2.x()), + (std::max)(v1.y(), v2.y())); } /// @brief Return a vector with the exponent applied to each of diff --git a/Sources/OpenVDB/include/openvdb/math/Vec3.h b/Sources/OpenVDB/include/openvdb/math/Vec3.h index aaeecee6..46eb8bc7 100644 --- a/Sources/OpenVDB/include/openvdb/math/Vec3.h +++ b/Sources/OpenVDB/include/openvdb/math/Vec3.h @@ -633,9 +633,9 @@ template inline Vec3 minComponent(const Vec3 &v1, const Vec3 &v2) { return Vec3( - std::min(v1.x(), v2.x()), - std::min(v1.y(), v2.y()), - std::min(v1.z(), v2.z())); + (std::min)(v1.x(), v2.x()), + (std::min)(v1.y(), v2.y()), + (std::min)(v1.z(), v2.z())); } /// Return component-wise maximum of the two vectors. @@ -643,9 +643,9 @@ template inline Vec3 maxComponent(const Vec3 &v1, const Vec3 &v2) { return Vec3( - std::max(v1.x(), v2.x()), - std::max(v1.y(), v2.y()), - std::max(v1.z(), v2.z())); + (std::max)(v1.x(), v2.x()), + (std::max)(v1.y(), v2.y()), + (std::max)(v1.z(), v2.z())); } /// @brief Return a vector with the exponent applied to each of diff --git a/Sources/OpenVDB/include/openvdb/math/Vec4.h b/Sources/OpenVDB/include/openvdb/math/Vec4.h index 77ff7707..4ba9959e 100644 --- a/Sources/OpenVDB/include/openvdb/math/Vec4.h +++ b/Sources/OpenVDB/include/openvdb/math/Vec4.h @@ -529,10 +529,10 @@ template inline Vec4 minComponent(const Vec4 &v1, const Vec4 &v2) { return Vec4( - std::min(v1.x(), v2.x()), - std::min(v1.y(), v2.y()), - std::min(v1.z(), v2.z()), - std::min(v1.w(), v2.w())); + (std::min)(v1.x(), v2.x()), + (std::min)(v1.y(), v2.y()), + (std::min)(v1.z(), v2.z()), + (std::min)(v1.w(), v2.w())); } /// Return component-wise maximum of the two vectors. @@ -540,10 +540,10 @@ template inline Vec4 maxComponent(const Vec4 &v1, const Vec4 &v2) { return Vec4( - std::max(v1.x(), v2.x()), - std::max(v1.y(), v2.y()), - std::max(v1.z(), v2.z()), - std::max(v1.w(), v2.w())); + (std::max)(v1.x(), v2.x()), + (std::max)(v1.y(), v2.y()), + (std::max)(v1.z(), v2.z()), + (std::max)(v1.w(), v2.w())); } /// @brief Return a vector with the exponent applied to each of diff --git a/Sources/OpenVDB/include/openvdb/points/AttributeArray.h b/Sources/OpenVDB/include/openvdb/points/AttributeArray.h index 4fcfa2c2..11a5455e 100644 --- a/Sources/OpenVDB/include/openvdb/points/AttributeArray.h +++ b/Sources/OpenVDB/include/openvdb/points/AttributeArray.h @@ -50,9 +50,9 @@ inline IntegerT floatingPointToFixedPoint(const FloatT s) { static_assert(std::is_unsigned::value, "IntegerT must be unsigned"); - if (FloatT(0.0) > s) return std::numeric_limits::min(); - else if (FloatT(1.0) <= s) return std::numeric_limits::max(); - return IntegerT(s * FloatT(std::numeric_limits::max())); + if (FloatT(0.0) > s) return (std::numeric_limits::min)(); + else if (FloatT(1.0) <= s) return (std::numeric_limits::max)(); + return IntegerT(s * FloatT((std::numeric_limits::max)())); } @@ -61,7 +61,7 @@ inline FloatT fixedPointToFloatingPoint(const IntegerT s) { static_assert(std::is_unsigned::value, "IntegerT must be unsigned"); - return FloatT(s) / FloatT((std::numeric_limits::max())); + return FloatT(s) / FloatT(((std::numeric_limits::max)())); } template @@ -1147,8 +1147,8 @@ TypedAttributeArray::TypedAttributeArray( "a total size of at least the number of elements in the array.") } } - mSize = std::max(Index(1), mSize); - mStrideOrTotalSize = std::max(Index(1), mStrideOrTotalSize); + mSize = (std::max)(Index(1), mSize); + mStrideOrTotalSize = (std::max)(Index(1), mStrideOrTotalSize); Codec::encode(uniformValue, this->data()[0]); } diff --git a/Sources/OpenVDB/include/openvdb/points/AttributeSet.h b/Sources/OpenVDB/include/openvdb/points/AttributeSet.h index 50a9a56a..9a361ed2 100644 --- a/Sources/OpenVDB/include/openvdb/points/AttributeSet.h +++ b/Sources/OpenVDB/include/openvdb/points/AttributeSet.h @@ -38,7 +38,7 @@ using GroupType = uint8_t; class OPENVDB_API AttributeSet { public: - enum AttributePositionLabel : size_t { INVALID_POS = std::numeric_limits::max() }; + enum AttributePositionLabel : size_t { INVALID_POS = (std::numeric_limits::max)() }; using Ptr = std::shared_ptr; using ConstPtr = std::shared_ptr; @@ -468,7 +468,7 @@ class OPENVDB_API AttributeSet::Descriptor /// @brief Return a group offset that is not in use /// @param hint if provided, request a specific offset as a hint /// @return index of an offset or size_t max if no available group offsets - size_t unusedGroupOffset(size_t hint = std::numeric_limits::max()) const; + size_t unusedGroupOffset(size_t hint = (std::numeric_limits::max)()) const; /// @brief Determine if a move is required to efficiently compact the data and store the /// source name, offset and the target offset in the input parameters diff --git a/Sources/OpenVDB/include/openvdb/points/IndexFilter.h b/Sources/OpenVDB/include/openvdb/points/IndexFilter.h index 996a1961..f0cb086a 100644 --- a/Sources/OpenVDB/include/openvdb/points/IndexFilter.h +++ b/Sources/OpenVDB/include/openvdb/points/IndexFilter.h @@ -242,7 +242,7 @@ class RandomLeafFilter const float factor = targetPoints > currentPoints ? 1.0f : float(targetPoints) / float(currentPoints); std::mt19937 generator(seed); - std::uniform_int_distribution dist(0, std::numeric_limits::max() - 1); + std::uniform_int_distribution dist(0, (std::numeric_limits::max)() - 1); Index32 leafCounter = 0; float totalPointsFloat = 0.0f; @@ -284,7 +284,7 @@ class RandomLeafFilter const SeedCountPair& value = it->second; const unsigned int seed = static_cast(value.first); const auto total = static_cast(leaf.pointCount()); - mCount = std::min(value.second, total); + mCount = (std::min)(value.second, total); mIndices = generateRandomSubset(seed, mCount, total); @@ -295,7 +295,7 @@ class RandomLeafFilter inline void next() const { mSubsetOffset++; mNextIndex = mSubsetOffset >= mCount ? - std::numeric_limits::max() : + (std::numeric_limits::max)() : mIndices[mSubsetOffset]; } diff --git a/Sources/OpenVDB/include/openvdb/points/PointDataGrid.h b/Sources/OpenVDB/include/openvdb/points/PointDataGrid.h index a3ad60dd..ce379196 100644 --- a/Sources/OpenVDB/include/openvdb/points/PointDataGrid.h +++ b/Sources/OpenVDB/include/openvdb/points/PointDataGrid.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "AttributeArray.h" #include "AttributeArrayString.h" #include "AttributeGroup.h" @@ -31,11 +32,11 @@ #include #if defined(_WIN32) -#include +#include namespace boost { - using namespace std; + using namespace linb; } #endif // defined(_WIN32) @@ -60,7 +61,7 @@ readCompressedValues( std::istream& is, PointDataIndex32* destBuf, Index destC const bool seek = destBuf == nullptr; const size_t destBytes = destCount*sizeof(PointDataIndex32); - const size_t maximumBytes = std::numeric_limits::max(); + const size_t maximumBytes = (std::numeric_limits::max)(); if (destBytes >= maximumBytes) { OPENVDB_THROW(openvdb::IoError, "Cannot read more than " << maximumBytes << " bytes in voxel values.") @@ -82,7 +83,7 @@ readCompressedValues( std::istream& is, PointDataIndex32* destBuf, Index destC is.read(reinterpret_cast(&bytes16), sizeof(uint16_t)); } - if (bytes16 == std::numeric_limits::max()) { + if (bytes16 == (std::numeric_limits::max)()) { // read or seek uncompressed data if (seek) { is.seekg(destBytes, std::ios_base::cur); @@ -119,7 +120,7 @@ writeCompressedValues( std::ostream& os, PointDataIndex32* srcBuf, Index srcCou using compression::bloscCompress; const size_t srcBytes = srcCount*sizeof(PointDataIndex32); - const size_t maximumBytes = std::numeric_limits::max(); + const size_t maximumBytes = (std::numeric_limits::max)(); if (srcBytes >= maximumBytes) { OPENVDB_THROW(openvdb::IoError, "Cannot write more than " << maximumBytes << " bytes in voxel values.") @@ -150,7 +151,7 @@ writeCompressedValuesSize(std::ostream& os, const T* srcBuf, Index srcCount) using compression::bloscCompressedSize; const size_t srcBytes = srcCount*sizeof(T); - const size_t maximumBytes = std::numeric_limits::max(); + const size_t maximumBytes = (std::numeric_limits::max)(); if (srcBytes >= maximumBytes) { OPENVDB_THROW(openvdb::IoError, "Cannot write more than " << maximumBytes << " bytes in voxel values.") @@ -1565,11 +1566,11 @@ PointDataLeafNode::fill(const CoordBBox& bbox, const ValueType& valu // active state is permitted to be updated - for (Int32 x = bbox.min().x(); x <= bbox.max().x(); ++x) { + for (Int32 x = (bbox.min)().x(); x <= (bbox.max)().x(); ++x) { const Index offsetX = (x & (DIM-1u)) << 2*Log2Dim; - for (Int32 y = bbox.min().y(); y <= bbox.max().y(); ++y) { + for (Int32 y = (bbox.min)().y(); y <= (bbox.max)().y(); ++y) { const Index offsetXY = offsetX + ((y & (DIM-1u)) << Log2Dim); - for (Int32 z = bbox.min().z(); z <= bbox.max().z(); ++z) { + for (Int32 z = (bbox.min)().z(); z <= (bbox.max)().z(); ++z) { const Index offset = offsetXY + (z & (DIM-1u)); this->setValueMask(offset, active); } diff --git a/Sources/OpenVDB/include/openvdb/points/PointTransfer.h b/Sources/OpenVDB/include/openvdb/points/PointTransfer.h index d4496bbb..bc05ed51 100644 --- a/Sources/OpenVDB/include/openvdb/points/PointTransfer.h +++ b/Sources/OpenVDB/include/openvdb/points/PointTransfer.h @@ -453,8 +453,8 @@ struct RasterizePoints this->transform<>(search); // start the iteration from a leaf origin - const Coord min = (search.min() & ~(DIM-1)); - const Coord& max = search.max(); + const Coord min = ((search.min)() & ~(DIM-1)); + const Coord& max = (search.max)(); PointFilterT localFilter(mFilter); // loop over overlapping leaf nodes @@ -475,8 +475,8 @@ struct RasterizePoints localFilter.reset(*pointLeaf); // loop over point voxels which contribute to this leaf - const Coord& pmin(pbox.min()); - const Coord& pmax(pbox.max()); + const Coord& pmin((pbox.min)()); + const Coord& pmax((pbox.max)()); for (Coord ijk = pmin; ijk.x() <= pmax.x(); ++ijk.x()) { const Index i = ((ijk.x() & (DIM-1u)) << 2*LOG2DIM); // unsigned bit shift mult for (ijk.y() = pmin.y(); ijk.y() <= pmax.y(); ++ijk.y()) { @@ -527,7 +527,7 @@ struct RasterizePoints { const TransformTransfer* transform = static_cast(&mTransfer); - const BBoxd bbox(bounds.min().asVec3d(), bounds.max().asVec3d()); + const BBoxd bbox((bounds.min)().asVec3d(), (bounds.max)().asVec3d()); bounds = transform->sourceTransform().worldToIndexCellCentered( transform->targetTransform().indexToWorld(bbox)); } diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointConversionImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointConversionImpl.h index f812c032..472efe76 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointConversionImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointConversionImpl.h @@ -375,14 +375,14 @@ struct CalculatePositionBounds const math::Mat4d& inverse) : mPositions(positions) , mInverseMat(inverse) - , mMin(std::numeric_limits::max()) - , mMax(-std::numeric_limits::max()) {} + , mMin((std::numeric_limits::max)()) + , mMax(-(std::numeric_limits::max)()) {} CalculatePositionBounds(const CalculatePositionBounds& other, tbb::split) : mPositions(other.mPositions) , mInverseMat(other.mInverseMat) - , mMin(std::numeric_limits::max()) - , mMax(-std::numeric_limits::max()) {} + , mMin((std::numeric_limits::max)()) + , mMax(-(std::numeric_limits::max)()) {} void operator()(const tbb::blocked_range& range) { VecT pos; @@ -688,7 +688,7 @@ computeVoxelSize( const PositionWrapper& positions, { // dictated by the math::ScaleMap limit static const double minimumVoxelVolume(3e-15); - static const double maximumVoxelVolume(std::numeric_limits::max()); + static const double maximumVoxelVolume((std::numeric_limits::max)()); double voxelVolume = volume / static_cast(estimatedVoxelCount); bool valid = true; @@ -748,7 +748,7 @@ computeVoxelSize( const PositionWrapper& positions, // return default size if points are coincident - if (bbox.min() == bbox.max()) return voxelSize; + if ((bbox.min)() == (bbox.max)()) return voxelSize; double volume = bbox.volume(); diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointGroupImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointGroupImpl.h index 885024e7..5885a2f5 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointGroupImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointGroupImpl.h @@ -468,12 +468,12 @@ inline void setGroup( PointDataTreeT& tree, [](const typename IndexTreeManager::LeafRange& range, int64_t value) -> int64_t { for (auto leaf = range.begin(); leaf; ++leaf) { auto it = std::max_element(leaf->indices().begin(), leaf->indices().end()); - value = std::max(value, static_cast(*it)); + value = (std::max)(value, static_cast(*it)); } return value; }, [](const int64_t a, const int64_t b) { - return std::max(a, b); + return (std::max)(a, b); } ); diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointMoveImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointMoveImpl.h index 984c901f..4f86eb13 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointMoveImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointMoveImpl.h @@ -260,7 +260,7 @@ struct GlobalMovePointsOp if (i < mSortedIndices.size()) { return std::get<0>(this->leafIndexTriple(i)); } - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } Index sourceIndex() const @@ -498,7 +498,7 @@ inline void movePoints( PointDataGridT& points, LeafMap targetLeafMap; LeafIndexArray sourceIndices(targetLeafManager.leafCount(), - std::numeric_limits::max()); + (std::numeric_limits::max)()); LeafOffsetArray offsetMap(targetLeafManager.leafCount()); diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeFrustumImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeFrustumImpl.h index 9878751c..2434a192 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeFrustumImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeFrustumImpl.h @@ -245,8 +245,8 @@ struct RasterizeOp frustumBBox.intersect(*clipBBox); } - Vec3i outMin = frustumBBox.min().asVec3i(); - Vec3i outMax = frustumBBox.max().asVec3i(); + Vec3i outMin = (frustumBBox.min)().asVec3i(); + Vec3i outMax = (frustumBBox.max)().asVec3i(); const bool interrupt = interrupter && frustumBBox.volume() > interruptThreshold; @@ -288,7 +288,7 @@ struct RasterizeOp // and compute the enclosing bounding box in the output tree. Vec3R frustumMin; Vec3R frustumMax; - math::calculateBounds(frustum, inputBBoxWS.min(), inputBBoxWS.max(), + math::calculateBounds(frustum, (inputBBoxWS.min)(), (inputBBoxWS.max)(), frustumMin, frustumMax); CoordBBox frustumBBox(Coord::floor(frustumMin), Coord::ceil(frustumMax)); @@ -297,8 +297,8 @@ struct RasterizeOp frustumBBox.intersect(*clipBBox); } - Vec3i outMin = frustumBBox.min().asVec3i(); - Vec3i outMax = frustumBBox.max().asVec3i(); + Vec3i outMin = (frustumBBox.min)().asVec3i(); + Vec3i outMax = (frustumBBox.max)().asVec3i(); const bool interrupt = interrupter && frustumBBox.volume() > interruptThreshold; @@ -351,7 +351,7 @@ struct RasterizeOp const float shutterStartDt = mSettings.camera.shutterStart()/mSettings.framesPerSecond; const float shutterEndDt = mSettings.camera.shutterEnd()/mSettings.framesPerSecond; - const int motionSteps = std::max(1, mSettings.motionSamples-1); + const int motionSteps = (std::max)(1, mSettings.motionSamples-1); std::vector motionPositions(motionSteps+1, Vec3d()); std::vector frustumRadiusSizes(motionSteps+1, Vec2s()); @@ -631,14 +631,14 @@ struct RasterizeOp } else { // max radius is the largest index-space radius factoring in // that in frustum space a sphere is not rasterized as spherical - maxRadius = std::max(startRadius[0], startRadius[1]); - maxRadius = std::max(maxRadius, endRadius[0]); - maxRadius = std::max(maxRadius, endRadius[1]); + maxRadius = (std::max)(startRadius[0], startRadius[1]); + maxRadius = (std::max)(maxRadius, endRadius[0]); + maxRadius = (std::max)(maxRadius, endRadius[1]); } } if (doRadius) { - distanceWeight = std::min(distanceWeight, 1.0); + distanceWeight = (std::min)(distanceWeight, 1.0); // these arbitrary constants are how tightly spheres are packed together // irrespective of how large they are in index-space - if it is too low, the shape of @@ -647,7 +647,7 @@ struct RasterizeOp // diminishing returns towards the accuracy of the rasterized path double spherePacking = mSettings.accurateSphereMotionBlur ? 4.0 : 2.0; - const int steps = std::max(2, math::Ceil(distance * spherePacking / double(maxRadius)) + 1); + const int steps = (std::max)(2, math::Ceil(distance * spherePacking / double(maxRadius)) + 1); Vec3d sample(startPosition); const Vec3d offset(direction / (steps-1)); @@ -686,7 +686,7 @@ struct RasterizeOp } else { // compute direction and store vector length as max time mDdaRay.setMinTime(math::Delta::value()); - mDdaRay.setMaxTime(std::max(distance, math::Delta::value()*2.0)); + mDdaRay.setMaxTime((std::max)(distance, math::Delta::value()*2.0)); // DDA requires normalized directions direction.normalize(); @@ -1204,8 +1204,8 @@ FrustumRasterizerMask::FrustumRasterizerMask( const math::Transform& transform, if (!bbox.empty()) { // create world-space mask (with identity linear transform) MaskGrid::Ptr tempMask = MaskGrid::create(); - CoordBBox coordBBox(Coord::floor(bbox.min()), - Coord::ceil(bbox.max())); + CoordBBox coordBBox(Coord::floor((bbox.min)()), + Coord::ceil((bbox.max)())); tempMask->sparseFill(coordBBox, true, true); // resample mask to index space @@ -1225,8 +1225,8 @@ FrustumRasterizerMask::FrustumRasterizerMask( const math::Transform& transform, auto frustumMap = transform.template constMap(); if (frustumMap) { const auto& frustumBBox = frustumMap->getBBox(); - mClipBBox.reset(Coord::floor(frustumBBox.min()), - Coord::ceil(frustumBBox.max())); + mClipBBox.reset(Coord::floor((frustumBBox.min)()), + Coord::ceil((frustumBBox.max)())); } } } diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeSDFImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeSDFImpl.h index 20f560f5..c21dafa1 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeSDFImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeSDFImpl.h @@ -47,9 +47,9 @@ struct FixedBandRadius : public FixedRadius inline void reset(const PointDataTree::LeafNodeType&) const {} inline const FixedBandRadius& eval(const Index) const { return *this; } - inline ValueT min() const { return mMinSearchIS; } + inline ValueT (min)() const { return mMinSearchIS; } inline ValueT minSq() const { return mMinSearchSqIS; } - inline ValueT max() const { return mMaxSearchIS; } + inline ValueT (max)() const { return mMaxSearchIS; } inline ValueT maxSq() const { return mMaxSearchSqIS; } private: const ValueT mMinSearchIS, mMaxSearchIS; @@ -256,7 +256,7 @@ struct SphericalTransfer : P = this->transformSourceToTarget(P); const auto& r = this->mRadius.eval(id); - const RealT max = r.max(); + const RealT max = (r.max)(); CoordBBox intersectBox(Coord::floor(P - max), Coord::ceil(P + max)); intersectBox.intersect(bounds); @@ -277,8 +277,8 @@ struct SphericalTransfer : const RealT min2 = r.minSq() == 0.0 ? -1.0 : r.minSq(); const RealT max2 = r.maxSq(); - const Coord& a(intersectBox.min()); - const Coord& b(intersectBox.max()); + const Coord& a((intersectBox.min)()); + const Coord& b((intersectBox.max)()); for (Coord c = a; c.x() <= b.x(); ++c.x()) { const RealT x2 = static_cast(math::Pow2(c.x() - P[0])); const Index i = ((c.x() & (DIM-1u)) << 2*LOG2DIM); // unsigned bit shift mult @@ -404,7 +404,7 @@ struct AveragePositionTransfer : // init buffers this->BaseT::initialize(origin, idx, bounds); mWeights.assign(NUM_VALUES, PosRadPair()); - if (CPG) mDist.assign(NUM_VALUES, std::numeric_limits::max()); + if (CPG) mDist.assign(NUM_VALUES, (std::numeric_limits::max)()); // We use the surface buffer to store the intermediate weights as // defined by the sum of k(|x−xj|/R), where k(s) = max(0,(1−s^2)^3) // and R is the maximum search distance. The active buffer currently @@ -450,8 +450,8 @@ struct AveragePositionTransfer : const RealT rad = r.get(); const RealT invsq = 1.0 / mMaxSearchSqIS; - const Coord& a(intersectBox.min()); - const Coord& b(intersectBox.max()); + const Coord& a((intersectBox.min)()); + const Coord& b((intersectBox.max)()); for (Coord c = a; c.x() <= b.x(); ++c.x()) { const RealT x2 = static_cast(math::Pow2(c.x() - P[0])); const Index i = ((c.x() & (DIM-1u)) << 2*LOG2DIM); // unsigned bit shift mult @@ -891,7 +891,7 @@ transferAttributes(const tree::LeafManager& manager, // @note we can use a point list impl to support larger counts // if necessary but this is far faster assert(manager.leafCount() < - size_t(std::numeric_limits::max())); + size_t((std::numeric_limits::max)())); // linearise cpg to avoid having to probe data const tree::LeafManager cpmanager(cpg); @@ -1114,8 +1114,8 @@ rasterizeSpheres(const PointDataGridT& points, // search distance at the SDF transform, including its half band const Real radiusIndexSpace = radius / vs; const FixedBandRadius rad(radiusIndexSpace, halfband); - const Real minBandRadius = rad.min(); - const Real maxBandRadius = rad.max(); + const Real minBandRadius = (rad.min)(); + const Real maxBandRadius = (rad.max)(); const size_t width = static_cast(math::RoundUp(maxBandRadius)); typename SdfT::Ptr surface = @@ -1263,7 +1263,7 @@ rasterizeSmoothSpheres(const PointDataGridT& points, const float background = static_cast(vs * halfband); const Real indexSpaceSearch = searchRadius / vs; const FixedBandRadius bands(radius / vs, halfband); - const Real max = bands.max(); + const Real max = (bands.max)(); typename SdfT::Ptr surface = initFixedSdf diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeTrilinearImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeTrilinearImpl.h index 4500dc75..4724ee17 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeTrilinearImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointRasterizeTrilinearImpl.h @@ -127,8 +127,8 @@ struct StaggeredTransfer : math::Vec3 centerw, macw; - const Coord& a(intersectBox.min()); - const Coord& b(intersectBox.max()); + const Coord& a((intersectBox.min)()); + const Coord& b((intersectBox.max)()); for (Coord c = a; c.x() <= b.x(); ++c.x()) { // @todo can probably simplify the double call to value() in some way const Index i = ((c.x() & (DIM-1u)) << 2*LOG2DIM); // unsigned bit shift mult @@ -207,12 +207,12 @@ struct CellCenteredTransfer : // build area of influence depending on point position CoordBBox intersectBox(ijk, ijk); - if (P.x() < 0.0f) intersectBox.min().x() -= 1; - else intersectBox.max().x() += 1; - if (P.y() < 0.0f) intersectBox.min().y() -= 1; - else intersectBox.max().y() += 1; - if (P.z() < 0.0f) intersectBox.min().z() -= 1; - else intersectBox.max().z() += 1; + if (P.x() < 0.0f) (intersectBox.min)().x() -= 1; + else (intersectBox.max)().x() += 1; + if (P.y() < 0.0f) (intersectBox.min)().y() -= 1; + else (intersectBox.max)().y() += 1; + if (P.z() < 0.0f) (intersectBox.min)().z() -= 1; + else (intersectBox.max)().z() += 1; assert(intersectBox.volume() == 8); intersectBox.intersect(bounds); @@ -224,8 +224,8 @@ struct CellCenteredTransfer : const SourceValueT s(this->mSHandle->get(id)); math::Vec3 centerw; - const Coord& a(intersectBox.min()); - const Coord& b(intersectBox.max()); + const Coord& a((intersectBox.min)()); + const Coord& b((intersectBox.max)()); for (Coord c = a; c.x() <= b.x(); ++c.x()) { const Index i = ((c.x() & (DIM-1u)) << 2*LOG2DIM); // unsigned bit shift mult const RealT x = static_cast(c.x()-ijk.x()); // distance from ijk to c diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointReplicateImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointReplicateImpl.h index e817fc0c..1fb3c170 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointReplicateImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointReplicateImpl.h @@ -132,7 +132,7 @@ replicate(const PointDataGridT& source, const auto& sourceLeaf = sourceManager.leaf(pos); // @note This really shoudn't return uint64_t as AttributeArray's size is // limited to the max of a uint32_t... - assert(sourceLeaf.pointCount() < Index64(std::numeric_limits::max())); + assert(sourceLeaf.pointCount() < Index64((std::numeric_limits::max)())); const Index sourceCount = static_cast(sourceLeaf.pointCount()); Index uniformMultiplier = multiplier; @@ -146,7 +146,7 @@ replicate(const PointDataGridT& source, // based on a scale. Should only be called if useScale is true, // otherwise the scaleHandle will be reset or null auto getPointsToGenerate = [&](const Index index) -> Index { - const float scale = std::max(0.0f, scaleHandle->get(index)); + const float scale = (std::max)(0.0f, scaleHandle->get(index)); return static_cast (math::Round(static_cast(multiplier) * scale)); }; diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointScatterImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointScatterImpl.h index ac95c6af..2b953ca5 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointScatterImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointScatterImpl.h @@ -391,7 +391,7 @@ nonUniformPointScatter(const GridT& grid, if (iter.isValueOn()) { double fractional = double(accessor.getValue(iter.getCoord())) * pointsPerVoxel; - fractional = std::max(0.0, fractional); + fractional = (std::max)(0.0, fractional); int count = int(fractional); if (rand01() < (fractional - double(count))) ++count; else if (count == 0) leafIter->setValueOff(iter.pos()); diff --git a/Sources/OpenVDB/include/openvdb/points/impl/PointStatisticsImpl.h b/Sources/OpenVDB/include/openvdb/points/impl/PointStatisticsImpl.h index 9fad4b0f..0523e8bf 100644 --- a/Sources/OpenVDB/include/openvdb/points/impl/PointStatisticsImpl.h +++ b/Sources/OpenVDB/include/openvdb/points/impl/PointStatisticsImpl.h @@ -29,13 +29,13 @@ struct ScalarMinMax ScalarMinMax(const ExtentT& init) : mMinMax(init) {} inline void operator()(const ValueT& b) { - mMinMax.first = std::min(mMinMax.first, b); - mMinMax.second = std::max(mMinMax.second, b); + mMinMax.first = (std::min)(mMinMax.first, b); + mMinMax.second = (std::max)(mMinMax.second, b); } inline void operator()(const ExtentT& b) { - mMinMax.first = std::min(mMinMax.first, b.first); - mMinMax.second = std::max(mMinMax.second, b.second); + mMinMax.first = (std::min)(mMinMax.first, b.first); + mMinMax.second = (std::max)(mMinMax.second, b.second); } inline const ExtentT& get() const { return mMinMax; } ExtentT mMinMax; @@ -172,7 +172,7 @@ bool evalExtents(const PointDataTreeT& points, const size_t size = handle.isUniform() ? 1 : handle.size(); ExtentOp op(handle.get(0)); for (size_t i = 1; i < size; ++i) { - assert(i < size_t(std::numeric_limits::max())); + assert(i < size_t((std::numeric_limits::max)())); op(handle.get(Index(i))); } if (!values.empty()) { @@ -352,7 +352,7 @@ bool evalAverage(const PointDataTreeT& points, } else { for (size_t i = 1; i < size; ++i) { - assert(i < size_t(std::numeric_limits::max())); + assert(i < size_t((std::numeric_limits::max)())); S->add(ResultT(handle.get(Index(i)))); } } @@ -436,7 +436,7 @@ bool accumulate(const PointDataTreeT& points, const size_t size = handle.isUniform() ? 1 : handle.size(); auto total = ResultT(handle.get(0)); for (size_t i = 1; i < size; ++i) { - assert(i < size_t(std::numeric_limits::max())); + assert(i < size_t((std::numeric_limits::max)())); total += ResultT(handle.get(Index(i))); } values[leaf.pos()].reset(new ResultT(total)); diff --git a/Sources/OpenVDB/include/openvdb/python/PyGrid.h b/Sources/OpenVDB/include/openvdb/python/PyGrid.h index 17c21d99..5b13f6fb 100644 --- a/Sources/OpenVDB/include/openvdb/python/PyGrid.h +++ b/Sources/OpenVDB/include/openvdb/python/PyGrid.h @@ -179,7 +179,7 @@ evalLeafBoundingBox(const GridType& grid) { CoordBBox bbox; grid.tree().evalLeafBoundingBox(bbox); - return std::make_tuple(bbox.min(), bbox.max()); + return std::make_tuple((bbox.min)(), (bbox.max)()); } @@ -240,7 +240,7 @@ inline std::tuple evalMinMax(const GridType& grid) { const math::MinMax extrema = tools::minMax(grid.tree()); - return std::make_tuple(extrema.min(), extrema.max()); + return std::make_tuple((extrema.min)(), (extrema.max)()); } @@ -250,7 +250,7 @@ getIndexRange(const GridType& grid) { CoordBBox bbox; grid.tree().getIndexRange(bbox); - return std::make_tuple(bbox.min(), bbox.max()); + return std::make_tuple((bbox.min)(), (bbox.max)()); } @@ -1138,8 +1138,8 @@ class IterValueProxy ValueT getValue() const { return *mIter; } bool getActive() const { return mIter.isValueOn(); } Index getDepth() const { return mIter.getDepth(); } - Coord getBBoxMin() const { return mIter.getBoundingBox().min(); } - Coord getBBoxMax() const { return mIter.getBoundingBox().max(); } + Coord getBBoxMin() const { return (mIter.getBoundingBox().min)(); } + Coord getBBoxMax() const { return (mIter.getBoundingBox().max)(); } Index64 getVoxelCount() const { return mIter.getVoxelCount(); } void setValue(const ValueT& val) { SetterT::setValue(mIter, val); } diff --git a/Sources/OpenVDB/include/openvdb/python/PyTypeCasters.h b/Sources/OpenVDB/include/openvdb/python/PyTypeCasters.h index ea176b4f..9472e67a 100644 --- a/Sources/OpenVDB/include/openvdb/python/PyTypeCasters.h +++ b/Sources/OpenVDB/include/openvdb/python/PyTypeCasters.h @@ -709,8 +709,8 @@ namespace pybind11 { namespace detail { metadata.reset(new openvdb::BoolMetadata(val.cast())); } else if (py::isinstance(val)) { const openvdb::Int64 n = val.cast(); - if (n <= std::numeric_limits::max() - && n >= std::numeric_limits::min()) { + if (n <= (std::numeric_limits::max)() + && n >= (std::numeric_limits::min)()) { metadata.reset(new openvdb::Int32Metadata(static_cast(n))); } else { metadata.reset(new openvdb::Int64Metadata(n)); diff --git a/Sources/OpenVDB/include/openvdb/tools/Clip.h b/Sources/OpenVDB/include/openvdb/tools/Clip.h index aa22aebb..e4af865a 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Clip.h +++ b/Sources/OpenVDB/include/openvdb/tools/Clip.h @@ -356,7 +356,7 @@ clip(const GridType& grid, const BBoxd& bbox, bool keepInterior) // Transform the world-space bounding box into the source grid's index space. Vec3d idxMin, idxMax; - math::calculateBounds(grid.constTransform(), bbox.min(), bbox.max(), idxMin, idxMax); + math::calculateBounds(grid.constTransform(), (bbox.min)(), (bbox.max)(), idxMin, idxMax); CoordBBox region(Coord::floor(idxMin), Coord::floor(idxMax)); // Construct a boolean mask grid that is true inside the index-space bounding box // and false everywhere else. @@ -420,7 +420,7 @@ clip(const GridType& inGrid, const math::NonlinearFrustumMap& frustumMap, bool k // Return the frustum index-space bounding box of the corners of // the given grid index-space bounding box. auto toFrustumIndexSpace = [&](const CoordBBox& inBBox) -> BBoxd { - const Coord bounds[2] = { inBBox.min(), inBBox.max() }; + const Coord bounds[2] = { (inBBox.min)(), (inBBox.max)() }; Coord ijk; BBoxd outBBox; for (int i = 0; i < 8; ++i) { @@ -484,7 +484,7 @@ clip(const GridType& inGrid, const math::NonlinearFrustumMap& frustumMap, bool k break; case CopyTile::kFull: // Copy the entire tile. - outAcc.addTile(tileIter.getLevel(), tileBBox.min(), tileValue, tileActive); + outAcc.addTile(tileIter.getLevel(), (tileBBox.min)(), tileValue, tileActive); break; case CopyTile::kPartial: // Copy only voxels inside the clipping region. @@ -532,13 +532,13 @@ clip(const GridType& inGrid, const math::NonlinearFrustumMap& frustumMap, bool k const auto leafFrustumBBox = toFrustumIndexSpace(leafBBox); if (keepInterior) { if (frustumIndexBBox.hasOverlap(leafFrustumBBox)) { - outAcc.touchLeaf(leafBBox.min()); + outAcc.touchLeaf((leafBBox.min)()); } } else { if (!frustumIndexBBox.hasOverlap(leafFrustumBBox) || !frustumIndexBBox.isInside(leafFrustumBBox)) { - outAcc.touchLeaf(leafBBox.min()); + outAcc.touchLeaf((leafBBox.min)()); } } } diff --git a/Sources/OpenVDB/include/openvdb/tools/Composite.h b/Sources/OpenVDB/include/openvdb/tools/Composite.h index 3dda24de..36a4e2fc 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Composite.h +++ b/Sources/OpenVDB/include/openvdb/tools/Composite.h @@ -103,28 +103,28 @@ namespace composite { // composite::min() and composite::max() for non-vector types compare with operator<(). template inline const typename std::enable_if::IsVec, T>::type& // = T if T is not a vector type -min(const T& a, const T& b) { return std::min(a, b); } +(min)(const T& a, const T& b) { return (std::min)(a, b); } template inline const typename std::enable_if::IsVec, T>::type& -max(const T& a, const T& b) { return std::max(a, b); } +(max)(const T& a, const T& b) { return (std::max)(a, b); } // composite::min() and composite::max() for OpenVDB vector types compare by magnitude. template inline const typename std::enable_if::IsVec, T>::type& // = T if T is a vector type -min(const T& a, const T& b) +(min)(const T& a, const T& b) { const typename T::ValueType aMag = a.lengthSqr(), bMag = b.lengthSqr(); - return (aMag < bMag ? a : (bMag < aMag ? b : std::min(a, b))); + return (aMag < bMag ? a : (bMag < aMag ? b : (std::min)(a, b))); } template inline const typename std::enable_if::IsVec, T>::type& -max(const T& a, const T& b) +(max)(const T& a, const T& b) { const typename T::ValueType aMag = a.lengthSqr(), bMag = b.lengthSqr(); - return (aMag < bMag ? b : (bMag < aMag ? a : std::max(a, b))); + return (aMag < bMag ? b : (bMag < aMag ? a : (std::max)(a, b))); } @@ -139,7 +139,7 @@ divide(const T& a, const T& b) const T zero(0); if (b != zero) return a / b; if (a == zero) return 0; - return (a > 0 ? std::numeric_limits::max() : -std::numeric_limits::max()); + return (a > 0 ? (std::numeric_limits::max)() : -(std::numeric_limits::max)()); } // If b is true, return a / 1 = a. @@ -752,7 +752,7 @@ compMax(GridOrTreeT& aTree, GridOrTreeT& bTree) using ValueT = typename TreeT::ValueType; struct Local { static inline void op(CombineArgs& args) { - args.setResult(composite::max(args.a(), args.b())); + args.setResult((composite::max)(args.a(), args.b())); } }; Adapter::tree(aTree).combineExtended(Adapter::tree(bTree), Local::op, /*prune=*/false); @@ -768,7 +768,7 @@ compMin(GridOrTreeT& aTree, GridOrTreeT& bTree) using ValueT = typename TreeT::ValueType; struct Local { static inline void op(CombineArgs& args) { - args.setResult(composite::min(args.a(), args.b())); + args.setResult((composite::min)(args.a(), args.b())); } }; Adapter::tree(aTree).combineExtended(Adapter::tree(bTree), Local::op, /*prune=*/false); diff --git a/Sources/OpenVDB/include/openvdb/tools/Count.h b/Sources/OpenVDB/include/openvdb/tools/Count.h index c4db00d6..6167f015 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Count.h +++ b/Sources/OpenVDB/include/openvdb/tools/Count.h @@ -344,8 +344,8 @@ struct MinMaxValuesOp using ValueT = typename TreeType::ValueType; explicit MinMaxValuesOp() - : min(zeroVal()) - , max(zeroVal()) + : mmin(zeroVal()) + , mmax(zeroVal()) , seen_value(false) {} MinMaxValuesOp(const MinMaxValuesOp&, tbb::split) @@ -357,18 +357,18 @@ struct MinMaxValuesOp if (auto iter = node.cbeginValueOn()) { if (!seen_value) { seen_value = true; - min = max = *iter; + mmin = mmax = *iter; ++iter; } for (; iter; ++iter) { const ValueT val = *iter; - if (math::cwiseLessThan(val, min)) - min = val; + if (math::cwiseLessThan(val, mmin)) + mmin = val; - if (math::cwiseGreaterThan(val, max)) - max = val; + if (math::cwiseGreaterThan(val, mmax)) + mmax = val; } } @@ -380,21 +380,21 @@ struct MinMaxValuesOp if (!other.seen_value) return true; if (!seen_value) { - min = other.min; - max = other.max; + mmin = other.mmin; + mmax = other.mmax; } else { - if (math::cwiseLessThan(other.min, min)) - min = other.min; - if (math::cwiseGreaterThan(other.max, max)) - max = other.max; + if (math::cwiseLessThan(other.mmin, mmin)) + mmin = other.mmin; + if (math::cwiseGreaterThan(other.mmax, mmax)) + mmax = other.mmax; } seen_value = true; return true; } - ValueT min, max; + ValueT mmin, mmax; private: @@ -521,7 +521,7 @@ math::MinMax minMax(const TreeT& tree, bool threaded) tree::DynamicNodeManager nodeManager(tree); nodeManager.reduceTopDown(op, threaded); - return math::MinMax(op.min, op.max); + return math::MinMax(op.mmin, op.mmax); } diff --git a/Sources/OpenVDB/include/openvdb/tools/Dense.h b/Sources/OpenVDB/include/openvdb/tools/Dense.h index cb65315d..f2404907 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Dense.h +++ b/Sources/OpenVDB/include/openvdb/tools/Dense.h @@ -251,7 +251,7 @@ class Dense : public DenseBase inline const CoordBBox& bbox() const { return BaseT::mBBox; } /// Return the grid's origin in index coordinates. - inline const Coord& origin() const { return BaseT::mBBox.min(); } + inline const Coord& origin() const { return BaseT::(mBBox.min)(); } /// @brief Return the number of voxels contained in this grid. inline Index64 valueCount() const { return BaseT::mBBox.volume(); } @@ -327,15 +327,15 @@ class Dense : public DenseBase inline size_t coordToOffset(const Coord& xyz) const { assert(BaseT::mBBox.isInside(xyz)); - return BaseT::coordToOffset(size_t(xyz[0]-BaseT::mBBox.min()[0]), - size_t(xyz[1]-BaseT::mBBox.min()[1]), - size_t(xyz[2]-BaseT::mBBox.min()[2])); + return BaseT::coordToOffset(size_t(xyz[0]-BaseT::(mBBox.min)()[0]), + size_t(xyz[1]-BaseT::(mBBox.min)()[1]), + size_t(xyz[2]-BaseT::(mBBox.min)()[2])); } /// @brief Return the global coordinate corresponding to the specified linear offset. inline Coord offsetToCoord(size_t n) const { - return this->offsetToLocalCoord(n) + BaseT::mBBox.min(); + return this->offsetToLocalCoord(n) + BaseT::(mBBox.min)(); } /// @brief Return the memory footprint of this Dense grid in bytes. @@ -473,15 +473,15 @@ class CopyFromDense mBlocks = new std::vector(); const CoordBBox& bbox = mDense->bbox(); // Pre-process: Construct a list of blocks aligned with (potential) leaf nodes - for (CoordBBox sub=bbox; sub.min()[0] <= bbox.max()[0]; sub.min()[0] = sub.max()[0] + 1) { - for (sub.min()[1] = bbox.min()[1]; sub.min()[1] <= bbox.max()[1]; - sub.min()[1] = sub.max()[1] + 1) + for (CoordBBox sub=bbox; (sub.min)()[0] <= (bbox.max)()[0]; (sub.min)()[0] = (sub.max)()[0] + 1) { + for ((sub.min)()[1] = (bbox.min)()[1]; (sub.min)()[1] <= (bbox.max)()[1]; + (sub.min)()[1] = (sub.max)()[1] + 1) { - for (sub.min()[2] = bbox.min()[2]; sub.min()[2] <= bbox.max()[2]; - sub.min()[2] = sub.max()[2] + 1) + for ((sub.min)()[2] = (bbox.min)()[2]; (sub.min)()[2] <= (bbox.max)()[2]; + (sub.min)()[2] = (sub.max)()[2] + 1) { - sub.max() = Coord::minComponent(bbox.max(), - (sub.min()&(~(LeafT::DIM-1u))).offsetBy(LeafT::DIM-1u)); + (sub.max)() = Coord::minComponent((bbox.max)(), + ((sub.min)()&(~(LeafT::DIM-1u))).offsetBy(LeafT::DIM-1u)); mBlocks->push_back(Block(sub)); } } @@ -501,7 +501,7 @@ class CopyFromDense if (block.leaf) { acc.addLeaf(block.leaf); } else if (block.tile.second) {//only background tiles are inactive - acc.addTile(1, block.bbox.min(), block.tile.first, true);//leaf tile + acc.addTile(1, block.(bbox.min)(), block.tile.first, true);//leaf tile } } delete mBlocks; @@ -525,11 +525,11 @@ class CopyFromDense if (mAccessor.get() == nullptr) {//i.e. empty target tree leaf->fill(mTree->background(), false); } else {//account for existing leaf nodes in the target tree - if (const LeafT* target = mAccessor->probeConstLeaf(bbox.min())) { + if (const LeafT* target = mAccessor->probeConstLeaf((bbox.min)())) { (*leaf) = (*target); } else { ValueT value = zeroVal(); - bool state = mAccessor->probeValue(bbox.min(), value); + bool state = mAccessor->probeValue((bbox.min)(), value); leaf->fill(value, state); } } @@ -537,7 +537,7 @@ class CopyFromDense leaf->copyFromDense(bbox, *mDense, mTree->background(), mTolerance); if (!leaf->isConstant(block.tile.first, block.tile.second, mTolerance)) { - leaf->setOrigin(bbox.min() & (~(LeafT::DIM - 1))); + leaf->setOrigin((bbox.min)() & (~(LeafT::DIM - 1))); block.leaf = leaf; leaf = new LeafT(); } diff --git a/Sources/OpenVDB/include/openvdb/tools/DenseSparseTools.h b/Sources/OpenVDB/include/openvdb/tools/DenseSparseTools.h index cbc3639c..1996c5fa 100644 --- a/Sources/OpenVDB/include/openvdb/tools/DenseSparseTools.h +++ b/Sources/OpenVDB/include/openvdb/tools/DenseSparseTools.h @@ -233,8 +233,8 @@ class SparseExtractor // Snap the bbox to nearest leaf nodes min and max - openvdb::math::Coord padded_min = mBBox.min(); - openvdb::math::Coord padded_max = mBBox.max(); + openvdb::math::Coord padded_min = (mBBox.min)(); + openvdb::math::Coord padded_max = (mBBox.max)(); padded_min &= ~(mWidth - 1); @@ -692,7 +692,7 @@ class DenseTransformer // The stride in the z-direction. // Note: the bbox is [inclusive, inclusive] - const size_t zlength = size_t(mBBox.max().z() - mBBox.min().z() + 1); + const size_t zlength = size_t((mBBox.max)().z() - (mBBox.min)().z() + 1); const IntType imin = range.rows().begin(); const IntType imax = range.rows().end(); @@ -700,7 +700,7 @@ class DenseTransformer const IntType jmax = range.cols().end(); - openvdb::math::Coord xyz(imin, jmin, mBBox.min().z()); + openvdb::math::Coord xyz(imin, jmin, (mBBox.min)().z()); for (xyz[0] = imin; xyz[0] != imax; ++xyz[0]) { for (xyz[1] = jmin; xyz[1] != jmax; ++xyz[1]) { @@ -887,16 +887,16 @@ class SparseToDenseCompositor using IntType = openvdb::math::Coord::ValueType; const ValueT sbeta = strength * beta; - openvdb::math::Coord ijk = bbox.min(); + openvdb::math::Coord ijk = (bbox.min)(); if (alpha.isDense() /*all active values*/) { // Optimal path for dense alphaLeaf - const IntType size = bbox.max().z() + 1 - bbox.min().z(); + const IntType size = (bbox.max)().z() + 1 - (bbox.min)().z(); - for (ijk[0] = bbox.min().x(); ijk[0] < bbox.max().x() + 1; ++ijk[0]) { - for (ijk[1] = bbox.min().y(); ijk[1] < bbox.max().y() + 1; ++ijk[1]) { + for (ijk[0] = (bbox.min)().x(); ijk[0] < (bbox.max)().x() + 1; ++ijk[0]) { + for (ijk[1] = (bbox.min)().y(); ijk[1] < (bbox.max)().y() + 1; ++ijk[1]) { ValueT* d = const_cast(&dense.getValue(ijk)); const ValueT* a = &alpha.getValue(ijk); @@ -912,9 +912,9 @@ class SparseToDenseCompositor // AlphaLeaf has non-active cells. - for (ijk[0] = bbox.min().x(); ijk[0] < bbox.max().x() + 1; ++ijk[0]) { - for (ijk[1] = bbox.min().y(); ijk[1] < bbox.max().y() + 1; ++ijk[1]) { - for (ijk[2] = bbox.min().z(); ijk[2] < bbox.max().z() + 1; ++ijk[2]) { + for (ijk[0] = (bbox.min)().x(); ijk[0] < (bbox.max)().x() + 1; ++ijk[0]) { + for (ijk[1] = (bbox.min)().y(); ijk[1] < (bbox.max)().y() + 1; ++ijk[1]) { + for (ijk[2] = (bbox.min)().z(); ijk[2] < (bbox.max)().z() + 1; ++ijk[2]) { if (alpha.isValueOn(ijk)) { dense.setValue(ijk, CompositeMethod::apply(dense.getValue(ijk), @@ -945,9 +945,9 @@ class SparseToDenseCompositor /// bounding box of the dense volume const openvdb::math::CoordBBox& bbox = mDense.bbox(); - Range3d range(bbox.min().x(), bbox.max().x(), LeafT::DIM, - bbox.min().y(), bbox.max().y(), LeafT::DIM, - bbox.min().z(), bbox.max().z(), LeafT::DIM); + Range3d range((bbox.min)().x(), (bbox.max)().x(), LeafT::DIM, + (bbox.min)().y(), (bbox.max)().y(), LeafT::DIM, + (bbox.min)().z(), (bbox.max)().z(), LeafT::DIM); // Iterate over the range, compositing into // the dense grid using value accessors for @@ -1104,7 +1104,7 @@ namespace ds const ValueT s /*trength*/, const ValueT beta, const ValueT /*sbeta*/) - { return ( ( 1 - s * alpha) * u + s * alpha * std::min(u, beta * v) ); } + { return ( ( 1 - s * alpha) * u + s * alpha * (std::min)(u, beta * v) ); } }; template @@ -1115,7 +1115,7 @@ namespace ds const ValueT s/*trength*/, const ValueT beta, const ValueT /*sbeta*/) - { return ( ( 1 - s * alpha ) * u + s * alpha * std::min(u, beta * v) ); } + { return ( ( 1 - s * alpha ) * u + s * alpha * (std::min)(u, beta * v) ); } }; template diff --git a/Sources/OpenVDB/include/openvdb/tools/FastSweeping.h b/Sources/OpenVDB/include/openvdb/tools/FastSweeping.h index 170517bd..f17efeb0 100644 --- a/Sources/OpenVDB/include/openvdb/tools/FastSweeping.h +++ b/Sources/OpenVDB/include/openvdb/tools/FastSweeping.h @@ -893,14 +893,14 @@ void FastSweeping::sweep(int nIter, bool finalize) //auto e = extrema(mGrid->beginValueOn());// 100x slower!!!! if (kernel.mFltMinExists || kernel.mFltMaxExists) { tree::NodeManager nodeManager(mSdfGrid->tree()); - PruneMinMaxFltKernel op(e.min(), e.max()); + PruneMinMaxFltKernel op((e.min)(), (e.max)()); nodeManager.foreachTopDown(op, true /* = threaded*/, 1 /* = grainSize*/); } #ifdef BENCHMARK_FAST_SWEEPING - std::cerr << "Min = " << e.min() << " Max = " << e.max() << std::endl; + std::cerr << "Min = " << (e.min)() << " Max = " << (e.max)() << std::endl; timer.restart("Changing asymmetric background value"); #endif - changeAsymmetricLevelSetBackground(mSdfGrid->tree(), e.max(), e.min());//multi-threaded + changeAsymmetricLevelSetBackground(mSdfGrid->tree(), (e.max)(), (e.min)());//multi-threaded #ifdef BENCHMARK_FAST_SWEEPING timer.stop(); @@ -918,7 +918,7 @@ struct FastSweeping::MinMaxKernel { using LeafMgr = tree::LeafManager; using LeafRange = typename LeafMgr::LeafRange; - MinMaxKernel() : mMin(std::numeric_limits::max()), mMax(-mMin), mFltMinExists(false), mFltMaxExists(true) {} + MinMaxKernel() : mMin((std::numeric_limits::max)()), mMax(-mMin), mFltMinExists(false), mFltMaxExists(true) {} MinMaxKernel(MinMaxKernel& other, tbb::split) : mMin(other.mMin), mMax(other.mMax), mFltMinExists(other.mFltMinExists), mFltMaxExists(other.mFltMaxExists) {} math::MinMax run(const SdfGridT &grid) @@ -933,8 +933,8 @@ struct FastSweeping::MinMaxKernel for (auto leafIter = r.begin(); leafIter; ++leafIter) { for (auto voxelIter = leafIter->beginValueOn(); voxelIter; ++voxelIter) { const SdfValueT v = *voxelIter; - const bool vEqFltMin = v == -std::numeric_limits::max(); - const bool vEqFltMax = v == std::numeric_limits::max(); + const bool vEqFltMin = v == -(std::numeric_limits::max)(); + const bool vEqFltMax = v == (std::numeric_limits::max)(); if (v < mMin && !vEqFltMin) mMin = v; if (v > mMax && !vEqFltMax) mMax = v; if (vEqFltMin) mFltMinExists = true; @@ -964,10 +964,10 @@ struct FastSweeping::PruneMinMaxFltKernel { // Root node void operator()(typename SdfTreeT::RootNodeType& node, size_t = 1) const { for (auto iter = node.beginValueAll(); iter; ++iter) { - if (*iter == -std::numeric_limits::max()) { + if (*iter == -(std::numeric_limits::max)()) { iter.setValue(mMin); } - if (*iter == std::numeric_limits::max()) { + if (*iter == (std::numeric_limits::max)()) { iter.setValue(mMax); } } @@ -978,10 +978,10 @@ struct FastSweeping::PruneMinMaxFltKernel { void operator()(NodeT& node, size_t = 1) const { for (auto iter = node.beginValueAll(); iter; ++iter) { - if (*iter == -std::numeric_limits::max()) { + if (*iter == -(std::numeric_limits::max)()) { iter.setValue(mMin); } - if (*iter == std::numeric_limits::max()) { + if (*iter == (std::numeric_limits::max)()) { iter.setValue(mMax); } } @@ -991,10 +991,10 @@ struct FastSweeping::PruneMinMaxFltKernel { void operator()(typename SdfTreeT::LeafNodeType& leaf, size_t = 1) const { for (auto iter = leaf.beginValueOn(); iter; ++iter) { - if (*iter == -std::numeric_limits::max()) { + if (*iter == -(std::numeric_limits::max)()) { iter.setValue(mMin); } - if (*iter == std::numeric_limits::max()) { + if (*iter == (std::numeric_limits::max)()) { iter.setValue(mMax); } } @@ -1028,7 +1028,7 @@ struct FastSweeping::DilateKernel #ifdef BENCHMARK_FAST_SWEEPING timer.restart("Changing background value"); #endif - static const SdfValueT Unknown = std::numeric_limits::max(); + static const SdfValueT Unknown = (std::numeric_limits::max)(); changeLevelSetBackground(mgr, Unknown);//multi-threaded #ifdef BENCHMARK_FAST_SWEEPING @@ -1057,7 +1057,7 @@ struct FastSweeping::DilateKernel LeafManagerT leafManager(mParent->mSdfGrid->tree()); auto kernel = [&](LeafT& leaf, size_t /*leafIdx*/) { - static const SdfValueT Unknown = std::numeric_limits::max(); + static const SdfValueT Unknown = (std::numeric_limits::max)(); const SdfValueT background = mBackground;//local copy auto* maskLeaf = mParent->mSweepMask.probeLeaf(leaf.origin()); SdfConstAccT sdfInputAcc(mSdfGridInput->tree()); @@ -1153,7 +1153,7 @@ struct FastSweeping::InitSdf // Process all tiles tree::NodeManager mgr(tree); mgr.foreachBottomUp(*this);//multi-threaded - tree.root().setBackground(std::numeric_limits::max(), false); + tree.root().setBackground((std::numeric_limits::max)(), false); if (hasActiveTiles) tree.voxelizeActiveTiles();//multi-threaded // cache the leaf node origins for fast lookup in the sweeping kernels @@ -1165,7 +1165,7 @@ struct FastSweeping::InitSdf { SweepMaskAccT sweepMaskAcc(mParent->mSweepMask); math::GradStencil stencil(*mSdfGrid); - const SdfValueT isoValue = mIsoValue, above = mAboveSign*std::numeric_limits::max();//local copy + const SdfValueT isoValue = mIsoValue, above = mAboveSign*(std::numeric_limits::max)();//local copy const SdfValueT h = mAboveSign*static_cast(mSdfGrid->voxelSize()[0]);//Voxel size for (auto leafIter = r.begin(); leafIter; ++leafIter) { SdfValueT* sdf = leafIter.buffer(1).data(); @@ -1189,13 +1189,13 @@ struct FastSweeping::InitSdf } else {//voxel is neighboring the iso-surface SdfValueT sum = 0; for (int i=0; i<6;) { - SdfValueT d = std::numeric_limits::max(), d2; + SdfValueT d = (std::numeric_limits::max)(), d2; if (mask.test(i++)) d = math::Abs(delta/(value-stencil.getValue(i))); if (mask.test(i++)) { d2 = math::Abs(delta/(value-stencil.getValue(i))); if (d2 < d) d = d2; } - if (d < std::numeric_limits::max()) sum += 1/(d*d); + if (d < (std::numeric_limits::max)()) sum += 1/(d*d); } sdf[voxelIter.pos()] = isAbove ? h / math::Sqrt(sum) : -h / math::Sqrt(sum); }// voxel is neighboring the iso-surface @@ -1208,7 +1208,7 @@ struct FastSweeping::InitSdf template void operator()(const RootOrInternalNodeT& node) const { - const SdfValueT isoValue = mIsoValue, above = mAboveSign*std::numeric_limits::max(); + const SdfValueT isoValue = mIsoValue, above = mAboveSign*(std::numeric_limits::max)(); for (auto it = node.cbeginValueAll(); it; ++it) { SdfValueT& v = const_cast(*it); v = v > isoValue ? above : -above; @@ -1275,7 +1275,7 @@ struct FastSweeping::InitExt {// Process all tiles tree::NodeManager mgr(tree1); mgr.foreachBottomUp(*this);//multi-threaded - tree1.root().setBackground(std::numeric_limits::max(), false); + tree1.root().setBackground((std::numeric_limits::max)(), false); if (hasActiveTiles) { #ifdef BENCHMARK_FAST_SWEEPING timer.restart("Voxelizing active tiles"); @@ -1315,7 +1315,7 @@ struct FastSweeping::InitExt math::GradStencil stencil(*mSdfGrid); const math::Transform& xform = mExtGrid->transform(); typename OpPoolT::reference op = mOpPool->local(); - const SdfValueT isoValue = mIsoValue, above = mAboveSign*std::numeric_limits::max();//local copy + const SdfValueT isoValue = mIsoValue, above = mAboveSign*(std::numeric_limits::max)();//local copy const SdfValueT h = mAboveSign*static_cast(mSdfGrid->voxelSize()[0]);//Voxel size for (auto leafIter = r.begin(); leafIter; ++leafIter) { SdfValueT *sdf = leafIter.buffer(1).data(); @@ -1346,9 +1346,9 @@ struct FastSweeping::InitExt // where we choose the value of the extension grid corresponding to // the smallest value of d in the 6 direction neighboring the current // voxel. - SdfValueT minD = std::numeric_limits::max(); + SdfValueT minD = (std::numeric_limits::max)(); for (int n=0, i=0; i<6;) { - SdfValueT d = std::numeric_limits::max(), d2; + SdfValueT d = (std::numeric_limits::max)(), d2; if (mask.test(i++)) { d = math::Abs(delta/(value-stencil.getValue(i))); n = i - 1; @@ -1360,7 +1360,7 @@ struct FastSweeping::InitExt n = i - 1; } } - if (d < std::numeric_limits::max()) { + if (d < (std::numeric_limits::max)()) { d2 = 1/(d*d); sum1 += d2; const Vec3R xyz(static_cast(ijk[0])+d*static_cast(FastSweeping::mOffset[n][0]), @@ -1383,7 +1383,7 @@ struct FastSweeping::InitExt template void operator()(const RootOrInternalNodeT& node) const { - const SdfValueT isoValue = mIsoValue, above = mAboveSign*std::numeric_limits::max(); + const SdfValueT isoValue = mIsoValue, above = mAboveSign*(std::numeric_limits::max)(); for (auto it = node.cbeginValueAll(); it; ++it) { SdfValueT& v = const_cast(*it); v = v > isoValue ? above : -above; @@ -1416,7 +1416,7 @@ struct FastSweeping::MaskKernel #endif auto &lsTree = mSdfGrid->tree(); - static const SdfValueT Unknown = std::numeric_limits::max(); + static const SdfValueT Unknown = (std::numeric_limits::max)(); #ifdef BENCHMARK_FAST_SWEEPING timer.restart("Changing background value"); @@ -1443,7 +1443,7 @@ struct FastSweeping::MaskKernel LeafManagerT leafManager(mParent->mSweepMask); auto kernel = [&](LeafT& leaf, size_t /*leafIdx*/) { - static const SdfValueT Unknown = std::numeric_limits::max(); + static const SdfValueT Unknown = (std::numeric_limits::max)(); SdfAccT acc(mSdfGrid->tree()); // The following hack is safe due to the topology union in // init and the fact that SdfValueT is known to be a floating point! @@ -1673,9 +1673,9 @@ struct FastSweeping::SweepingKernel ijk = origin + LeafT::offsetToLocalCoord(indexIter.pos()); // Find the closes neighbors in the three axial directions - d1 = std::min(NN(acc1, ijk, 0), NN(acc1, ijk, 1)); - d2 = std::min(NN(acc1, ijk, 2), NN(acc1, ijk, 3)); - d3 = std::min(NN(acc1, ijk, 4), NN(acc1, ijk, 5)); + d1 = (std::min)(NN(acc1, ijk, 0), NN(acc1, ijk, 1)); + d2 = (std::min)(NN(acc1, ijk, 2), NN(acc1, ijk, 3)); + d3 = (std::min)(NN(acc1, ijk, 4), NN(acc1, ijk, 5)); if (!(d1 || d2 || d3)) continue;//no valid neighbors diff --git a/Sources/OpenVDB/include/openvdb/tools/Filter.h b/Sources/OpenVDB/include/openvdb/tools/Filter.h index 7ff94409..1cc15fc7 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Filter.h +++ b/Sources/OpenVDB/include/openvdb/tools/Filter.h @@ -527,7 +527,7 @@ Filter::mean(int width, int iterations, const MaskType { if (iterations <= 0) return; mMask = mask; - const int w = std::max(1, width); + const int w = (std::max)(1, width); const bool serial = mGrainSize == 0; if (mInterrupter) mInterrupter->start("Applying mean filter"); @@ -581,7 +581,7 @@ Filter::gaussian(int width, int iterations, const Mask { if (iterations <= 0) return; mMask = mask; - const int w = std::max(1, width); + const int w = (std::max)(1, width); const bool serial = mGrainSize == 0; if (mInterrupter) mInterrupter->start("Applying Gaussian filter"); @@ -638,7 +638,7 @@ Filter::median(int width, int iterations, const MaskTy { if (iterations <= 0) return; mMask = mask; - const int w = std::max(1, width); + const int w = (std::max)(1, width); const bool serial = mGrainSize == 0; if (mInterrupter) mInterrupter->start("Applying median filter"); diff --git a/Sources/OpenVDB/include/openvdb/tools/FindActiveValues.h b/Sources/OpenVDB/include/openvdb/tools/FindActiveValues.h index bf2548e6..da8f6840 100644 --- a/Sources/OpenVDB/include/openvdb/tools/FindActiveValues.h +++ b/Sources/OpenVDB/include/openvdb/tools/FindActiveValues.h @@ -266,9 +266,9 @@ bool FindActiveValues::anyActiveValues(const CoordBBox &bbox, bool useAcc { // test early-out: the center of the bbox is active if (useAccessor) { - if (mAcc.isValueOn( (bbox.min() + bbox.max())>>1 )) return true; + if (mAcc.isValueOn( ((bbox.min)() + (bbox.max)())>>1 )) return true; } else { - if (mAcc.tree().isValueOn( (bbox.min() + bbox.max())>>1 )) return true; + if (mAcc.tree().isValueOn( ((bbox.min)() + (bbox.max)())>>1 )) return true; } for (auto& tile : mRootTiles) { @@ -392,10 +392,10 @@ typename NodeT::NodeMaskType FindActiveValues::getBBoxMask(const CoordBBo } else { b.intersect(bbox);// trim bounding box // transform bounding box from global to local coordinates - b.min() &= NodeT::DIM-1u; - b.min() >>= NodeT::ChildNodeType::TOTAL; - b.max() &= NodeT::DIM-1u; - b.max() >>= NodeT::ChildNodeType::TOTAL; + (b.min)() &= NodeT::DIM-1u; + (b.min)() >>= NodeT::ChildNodeType::TOTAL; + (b.max)() &= NodeT::DIM-1u; + (b.max)() >>= NodeT::ChildNodeType::TOTAL; assert( b.hasVolume() ); auto it = b.begin();// iterates over all the child nodes or tiles that intersects bbox for (const Coord& ijk = *it; it; ++it) { diff --git a/Sources/OpenVDB/include/openvdb/tools/GridTransformer.h b/Sources/OpenVDB/include/openvdb/tools/GridTransformer.h index 0b2cd4eb..31b8e6b9 100644 --- a/Sources/OpenVDB/include/openvdb/tools/GridTransformer.h +++ b/Sources/OpenVDB/include/openvdb/tools/GridTransformer.h @@ -99,7 +99,7 @@ class TileSampler: public Sampler /// @param tileVal the tile's value /// @param on the tile's active state TileSampler(const CoordBBox& b, const ValueT& tileVal, bool on): - mBBox(b.min().asVec3d(), b.max().asVec3d()), mVal(tileVal), mActive(on), mEmpty(false) + mBBox((b.min)().asVec3d(), (b.max)().asVec3d()), mVal(tileVal), mActive(on), mEmpty(false) { mBBox.expand(-this->radius()); // shrink the bounding box by the sample radius mEmpty = mBBox.empty(); @@ -300,7 +300,7 @@ decompose(const math::Mat4& m, math::Vec3& scale, bool hasRotation = false; bool validDecomposition = false; - T minAngle = std::numeric_limits::max(); + T minAngle = (std::numeric_limits::max)(); // If the transformation matrix contains a reflection, test different negative scales // to find a decomposition that favors the optimal resampling algorithm. @@ -324,8 +324,8 @@ decompose(const math::Mat4& m, math::Vec3& scale, if (xform.eq(rebuild)) { - const T maxAngle = std::max(std::abs(tmpAngle[0]), - std::max(std::abs(tmpAngle[1]), std::abs(tmpAngle[2]))); + const T maxAngle = (std::max)(std::abs(tmpAngle[0]), + (std::max)(std::abs(tmpAngle[1]), std::abs(tmpAngle[2]))); if (!(minAngle < maxAngle)) { // Update if less or equal. @@ -808,8 +808,8 @@ class GridResampler::RangeProcessor if (!mBBox.empty()) { // Intersect the leaf node's bounding box with mBBox. bbox = CoordBBox( - Coord::maxComponent(bbox.min(), mBBox.min()), - Coord::minComponent(bbox.max(), mBBox.max())); + Coord::maxComponent((bbox.min)(), (mBBox.min)()), + Coord::minComponent((bbox.max)(), (mBBox.max)())); } if (!bbox.empty()) { transformBBox(mXform, bbox, mInAcc, mOutAcc, mInterrupt); @@ -833,8 +833,8 @@ class GridResampler::RangeProcessor if (!mBBox.empty()) { // Intersect the tile's bounding box with mBBox. bbox = CoordBBox( - Coord::maxComponent(bbox.min(), mBBox.min()), - Coord::minComponent(bbox.max(), mBBox.max())); + Coord::maxComponent((bbox.min)(), (mBBox.min)()), + Coord::minComponent((bbox.max)(), (mBBox.max)())); } if (!bbox.empty()) { /// @todo This samples the tile voxel-by-voxel, which is much too slow. @@ -950,8 +950,8 @@ GridResampler::transformBBox( // Transform the corners of the input tree's bounding box // and compute the enclosing bounding box in the output tree. Vec3R - inRMin(bbox.min().x(), bbox.min().y(), bbox.min().z()), - inRMax(bbox.max().x()+1, bbox.max().y()+1, bbox.max().z()+1), + inRMin((bbox.min)().x(), (bbox.min)().y(), (bbox.min)().z()), + inRMax((bbox.max)().x()+1, (bbox.max)().y()+1, (bbox.max)().z()+1), outRMin = math::minComponent(xform.transform(inRMin), xform.transform(inRMax)), outRMax = math::maxComponent(xform.transform(inRMin), xform.transform(inRMax)); for (int i = 0; i < 8; ++i) { diff --git a/Sources/OpenVDB/include/openvdb/tools/LevelSetFilter.h b/Sources/OpenVDB/include/openvdb/tools/LevelSetFilter.h index a31b7344..14ac7737 100644 --- a/Sources/OpenVDB/include/openvdb/tools/LevelSetFilter.h +++ b/Sources/OpenVDB/include/openvdb/tools/LevelSetFilter.h @@ -235,7 +235,7 @@ LevelSetFilter::Filter::median(int width) mParent->leafs().rebuildAuxBuffers(1, mParent->getGrainSize()==0); mTask = std::bind(&Filter::medianImpl, - std::placeholders::_1, std::placeholders::_2, std::max(1, width)); + std::placeholders::_1, std::placeholders::_2, (std::max)(1, width)); this->cook(true); mParent->track(); @@ -271,7 +271,7 @@ LevelSetFilter::Filter::box(int width) { mParent->leafs().rebuildAuxBuffers(1, mParent->getGrainSize()==0); - width = std::max(1, width); + width = (std::max)(1, width); mTask = std::bind(&Filter::boxXImpl, std::placeholders::_1, std::placeholders::_2, width); this->cook(true); diff --git a/Sources/OpenVDB/include/openvdb/tools/LevelSetFracture.h b/Sources/OpenVDB/include/openvdb/tools/LevelSetFracture.h index b88bace7..c296b57c 100644 --- a/Sources/OpenVDB/include/openvdb/tools/LevelSetFracture.h +++ b/Sources/OpenVDB/include/openvdb/tools/LevelSetFracture.h @@ -108,14 +108,14 @@ struct FindMinMaxVoxelValue { using ValueType = typename LeafNodeType::ValueType; FindMinMaxVoxelValue(const std::vector& nodes) - : minValue(std::numeric_limits::max()) + : minValue((std::numeric_limits::max)()) , maxValue(-minValue) , mNodes(nodes.empty() ? nullptr : &nodes.front()) { } FindMinMaxVoxelValue(FindMinMaxVoxelValue& rhs, tbb::split) - : minValue(std::numeric_limits::max()) + : minValue((std::numeric_limits::max)()) , maxValue(-minValue) , mNodes(rhs.mNodes) { @@ -125,15 +125,15 @@ struct FindMinMaxVoxelValue { for (size_t n = range.begin(), N = range.end(); n < N; ++n) { const ValueType* data = mNodes[n]->buffer().data(); for (Index i = 0; i < LeafNodeType::SIZE; ++i) { - minValue = std::min(minValue, data[i]); - maxValue = std::max(maxValue, data[i]); + minValue = (std::min)(minValue, data[i]); + maxValue = (std::max)(maxValue, data[i]); } } } void join(FindMinMaxVoxelValue& rhs) { - minValue = std::min(minValue, rhs.minValue); - maxValue = std::max(maxValue, rhs.maxValue); + minValue = (std::min)(minValue, rhs.minValue); + maxValue = (std::max)(maxValue, rhs.maxValue); } ValueType minValue, maxValue; diff --git a/Sources/OpenVDB/include/openvdb/tools/LevelSetMorph.h b/Sources/OpenVDB/include/openvdb/tools/LevelSetMorph.h index 6812999b..7f4d4719 100644 --- a/Sources/OpenVDB/include/openvdb/tools/LevelSetMorph.h +++ b/Sources/OpenVDB/include/openvdb/tools/LevelSetMorph.h @@ -500,7 +500,7 @@ sampleXformedSpeed(const LeafRange& range, Index speedBuffer) if (!math::isApproxZero(s)) isZero = false; mMaxAbsS = math::Max(mMaxAbsS, math::Abs(s)); } - if (isZero) speed[0] = std::numeric_limits::max();//tag first voxel + if (isZero) speed[0] = (std::numeric_limits::max)();//tag first voxel } } else { const ValueType min = mParent->mMinMask, invNorm = 1.0f/(mParent->mDeltaMask); @@ -519,7 +519,7 @@ sampleXformedSpeed(const LeafRange& range, Index speedBuffer) if (!math::isApproxZero(s)) isZero = false; mMaxAbsS = math::Max(mMaxAbsS, math::Abs(s)); } - if (isZero) speed[0] = std::numeric_limits::max();//tag first voxel + if (isZero) speed[0] = (std::numeric_limits::max)();//tag first voxel } } } @@ -548,7 +548,7 @@ sampleAlignedSpeed(const LeafRange& range, Index speedBuffer) if (!math::isApproxZero(s)) isZero = false; mMaxAbsS = math::Max(mMaxAbsS, math::Abs(s)); } - if (isZero) speed[0] = std::numeric_limits::max();//tag first voxel + if (isZero) speed[0] = (std::numeric_limits::max)();//tag first voxel } } else { const ValueType min = mParent->mMinMask, invNorm = 1.0f/(mParent->mDeltaMask); @@ -566,7 +566,7 @@ sampleAlignedSpeed(const LeafRange& range, Index speedBuffer) if (!math::isApproxZero(s)) isZero = false; mMaxAbsS = math::Max(mMaxAbsS, math::Abs(s)); } - if (isZero) speed[0] = std::numeric_limits::max();//tag first voxel + if (isZero) speed[0] = (std::numeric_limits::max)();//tag first voxel } } } @@ -624,7 +624,7 @@ euler(const LeafRange& range, ValueType dt, for (typename LeafRange::Iterator leafIter = range.begin(); leafIter; ++leafIter) { const ValueType* speed = leafIter.buffer(speedBuffer).data(); - if (math::isExactlyEqual(speed[0], std::numeric_limits::max())) continue; + if (math::isExactlyEqual(speed[0], (std::numeric_limits::max)())) continue; const ValueType* phi = leafIter.buffer(phiBuffer).data(); ValueType* result = leafIter.buffer(resultBuffer).data(); for (VoxelIterT voxelIter = leafIter->cbeginValueOn(); voxelIter; ++voxelIter) { diff --git a/Sources/OpenVDB/include/openvdb/tools/LevelSetUtil.h b/Sources/OpenVDB/include/openvdb/tools/LevelSetUtil.h index fbf360e2..238e0818 100644 --- a/Sources/OpenVDB/include/openvdb/tools/LevelSetUtil.h +++ b/Sources/OpenVDB/include/openvdb/tools/LevelSetUtil.h @@ -44,7 +44,7 @@ namespace { template inline typename GridType::ValueType lsutilGridMax() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } template @@ -380,13 +380,13 @@ struct FindMinVoxelValue { using ValueType = typename LeafNodeType::ValueType; FindMinVoxelValue(LeafNodeType const * const * const leafnodes) - : minValue(std::numeric_limits::max()) + : minValue((std::numeric_limits::max)()) , mNodes(leafnodes) { } FindMinVoxelValue(FindMinVoxelValue& rhs, tbb::split) - : minValue(std::numeric_limits::max()) + : minValue((std::numeric_limits::max)()) , mNodes(rhs.mNodes) { } @@ -395,12 +395,12 @@ struct FindMinVoxelValue { for (size_t n = range.begin(), N = range.end(); n < N; ++n) { const ValueType* data = mNodes[n]->buffer().data(); for (Index i = 0; i < LeafNodeType::SIZE; ++i) { - minValue = std::min(minValue, data[i]); + minValue = (std::min)(minValue, data[i]); } } } - void join(FindMinVoxelValue& rhs) { minValue = std::min(minValue, rhs.minValue); } + void join(FindMinVoxelValue& rhs) { minValue = (std::min)(minValue, rhs.minValue); } ValueType minValue; @@ -414,13 +414,13 @@ struct FindMinTileValue { using ValueType = typename InternalNodeType::ValueType; FindMinTileValue(InternalNodeType const * const * const nodes) - : minValue(std::numeric_limits::max()) + : minValue((std::numeric_limits::max)()) , mNodes(nodes) { } FindMinTileValue(FindMinTileValue& rhs, tbb::split) - : minValue(std::numeric_limits::max()) + : minValue((std::numeric_limits::max)()) , mNodes(rhs.mNodes) { } @@ -429,12 +429,12 @@ struct FindMinTileValue { for (size_t n = range.begin(), N = range.end(); n < N; ++n) { typename InternalNodeType::ValueAllCIter it = mNodes[n]->beginValueAll(); for (; it; ++it) { - minValue = std::min(minValue, *it); + minValue = (std::min)(minValue, *it); } } } - void join(FindMinTileValue& rhs) { minValue = std::min(minValue, rhs.minValue); } + void join(FindMinTileValue& rhs) { minValue = (std::min)(minValue, rhs.minValue); } ValueType minValue; @@ -1089,7 +1089,7 @@ computeInteriorMask(const TreeType& tree, typename TreeType::ValueType iso) // have values less than or equal to the background value, so an isovalue // greater than or equal to the background value would produce a mask with // effectively infinite extent.) - iso = std::min(iso, + iso = (std::min)(iso, static_cast(tree.background() - math::Tolerance::value())); size_t numLeafNodes = 0, numInternalNodes = 0; @@ -1925,7 +1925,7 @@ struct FloodFillSign , mSegments(!segments.empty() ? &segments.front() : nullptr) , mMinValue(ValueType(0.0)) { - ValueType minSDFValue = std::numeric_limits::max(); + ValueType minSDFValue = (std::numeric_limits::max)(); { std::vector nodes; @@ -1934,7 +1934,7 @@ struct FloodFillSign if (!nodes.empty()) { FindMinTileValue minOp(nodes.data()); tbb::parallel_reduce(tbb::blocked_range(0, nodes.size()), minOp); - minSDFValue = std::min(minSDFValue, minOp.minValue); + minSDFValue = (std::min)(minSDFValue, minOp.minValue); } } @@ -1944,7 +1944,7 @@ struct FloodFillSign if (!nodes.empty()) { FindMinVoxelValue minOp(nodes.data()); tbb::parallel_reduce(tbb::blocked_range(0, nodes.size()), minOp); - minSDFValue = std::min(minSDFValue, minOp.minValue); + minSDFValue = (std::min)(minSDFValue, minOp.minValue); } } @@ -2196,18 +2196,18 @@ sdfToFogVolume(GridType& grid, typename GridType::ValueType cutoffDistance) } // Clamp cutoffDistance to min sdf value - ValueType minSDFValue = std::numeric_limits::max(); + ValueType minSDFValue = (std::numeric_limits::max)(); { level_set_util_internal::FindMinTileValue minOp(internalNodes.data()); tbb::parallel_reduce(tbb::blocked_range(0, internalNodes.size()), minOp); - minSDFValue = std::min(minSDFValue, minOp.minValue); + minSDFValue = (std::min)(minSDFValue, minOp.minValue); } if (minSDFValue > ValueType(0.0)) { level_set_util_internal::FindMinVoxelValue minOp(nodes.data()); tbb::parallel_reduce(tbb::blocked_range(0, nodes.size()), minOp); - minSDFValue = std::min(minSDFValue, minOp.minValue); + minSDFValue = (std::min)(minSDFValue, minOp.minValue); } cutoffDistance = -std::abs(cutoffDistance); @@ -2516,7 +2516,7 @@ segmentActiveVoxels(const GridOrTreeType& volume, // 2. Export segments - const size_t numSegments = std::max(size_t(1), maskSegmentArray.size()); + const size_t numSegments = (std::max)(size_t(1), maskSegmentArray.size()); std::vector outputSegmentArray(numSegments); if (maskSegmentArray.empty()) { @@ -2565,7 +2565,7 @@ segmentSDF(const GridOrTreeType& volume, std::vector maskSegmentArray; extractActiveVoxelSegmentMasks(*mask, maskSegmentArray); - const size_t numSegments = std::max(size_t(1), maskSegmentArray.size()); + const size_t numSegments = (std::max)(size_t(1), maskSegmentArray.size()); std::vector outputSegmentArray(numSegments); if (maskSegmentArray.empty()) { diff --git a/Sources/OpenVDB/include/openvdb/tools/Merge.h b/Sources/OpenVDB/include/openvdb/tools/Merge.h index 17b9ffe6..b05ede77 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Merge.h +++ b/Sources/OpenVDB/include/openvdb/tools/Merge.h @@ -524,7 +524,7 @@ bool TreeToMerge::MaskUnionOp::operator()(RootT& root, size_t /*idx*/) co [&](tbb::blocked_range& range) { for (Index i = range.begin(); i < range.end(); i++) { - children[i] = std::make_unique(Coord::max(), true, true); + children[i] = std::make_unique((Coord::max)(), true, true); } } ); diff --git a/Sources/OpenVDB/include/openvdb/tools/MeshToVolume.h b/Sources/OpenVDB/include/openvdb/tools/MeshToVolume.h index a43c53c0..4426fc7f 100644 --- a/Sources/OpenVDB/include/openvdb/tools/MeshToVolume.h +++ b/Sources/OpenVDB/include/openvdb/tools/MeshToVolume.h @@ -632,7 +632,7 @@ class CombineLeafNodes lhsIdxNode->setValueOn(offset, rhsIdxData[offset]); } else if (math::isExactlyEqual(rhsValue, lhsValue)) { lhsIdxNode->setValueOn(offset, - std::min(lhsIdxData[offset], rhsIdxData[offset])); + (std::min)(lhsIdxData[offset], rhsIdxData[offset])); } } } @@ -757,7 +757,7 @@ class ComputeNodeConnectivity ijk += step; } - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } @@ -774,7 +774,7 @@ class ComputeNodeConnectivity template struct LeafNodeConnectivityTable { - enum { INVALID_OFFSET = std::numeric_limits::max() }; + enum { INVALID_OFFSET = (std::numeric_limits::max)() }; using LeafNodeType = typename TreeType::LeafNodeType; @@ -1439,16 +1439,16 @@ struct ComputeIntersectingVoxelSign xyz[2] = double(ijk[2]); - bbox.min() = Coord::maxComponent(ijk.offsetBy(-1), nodeMin); - bbox.max() = Coord::minComponent(ijk.offsetBy(1), nodeMax); + (bbox.min)() = Coord::maxComponent(ijk.offsetBy(-1), nodeMin); + (bbox.max)() = Coord::minComponent(ijk.offsetBy(1), nodeMax); bool flipSign = false; - for (nijk[0] = bbox.min()[0]; nijk[0] <= bbox.max()[0] && !flipSign; ++nijk[0]) { + for (nijk[0] = (bbox.min)()[0]; nijk[0] <= (bbox.max)()[0] && !flipSign; ++nijk[0]) { xPos = (nijk[0] & (LeafNodeType::DIM - 1u)) << (2 * LeafNodeType::LOG2DIM); - for (nijk[1]=bbox.min()[1]; nijk[1] <= bbox.max()[1] && !flipSign; ++nijk[1]) { + for (nijk[1]=(bbox.min)()[1]; nijk[1] <= (bbox.max)()[1] && !flipSign; ++nijk[1]) { yPos = xPos + ((nijk[1] & (LeafNodeType::DIM-1u)) << LeafNodeType::LOG2DIM); - for (nijk[2] = bbox.min()[2]; nijk[2] <= bbox.max()[2]; ++nijk[2]) { + for (nijk[2] = (bbox.min)()[2]; nijk[2] <= (bbox.max)()[2]; ++nijk[2]) { pos = yPos + (nijk[2] & (LeafNodeType::DIM - 1u)); const Int32& polyIdx = idxData[pos]; @@ -1936,7 +1936,7 @@ struct VoxelizationData { VoxelizationData() - : distTree(std::numeric_limits::max()) + : distTree((std::numeric_limits::max)()) , distAcc(distTree) , indexTree(Int32(util::INVALID_IDX)) , indexAcc(indexTree) @@ -2086,15 +2086,15 @@ class VoxelizePolygons inline static int evalSubdivisionCount(const Triangle& prim) { const double ax = prim.a[0], bx = prim.b[0], cx = prim.c[0]; - const double dx = std::max(ax, std::max(bx, cx)) - std::min(ax, std::min(bx, cx)); + const double dx = (std::max)(ax, (std::max)(bx, cx)) - (std::min)(ax, (std::min)(bx, cx)); const double ay = prim.a[1], by = prim.b[1], cy = prim.c[1]; - const double dy = std::max(ay, std::max(by, cy)) - std::min(ay, std::min(by, cy)); + const double dy = (std::max)(ay, (std::max)(by, cy)) - (std::min)(ay, (std::min)(by, cy)); const double az = prim.a[2], bz = prim.b[2], cz = prim.c[2]; - const double dz = std::max(az, std::max(bz, cz)) - std::min(az, std::min(bz, cz)); + const double dz = (std::max)(az, (std::max)(bz, cz)) - (std::min)(az, (std::min)(bz, cz)); - return int(std::max(dx, std::max(dy, dz)) / double(TreeType::LeafNodeType::DIM * 2)); + return int((std::max)(dx, (std::max)(dy, dz)) / double(TreeType::LeafNodeType::DIM * 2)); } void evalTriangle(const Triangle& prim, VoxelizationDataType& data) const @@ -2210,7 +2210,7 @@ class VoxelizePolygons } else if (math::isExactlyEqual(dist, oldDist)) { // makes reduction deterministic when different polygons // produce the same distance value. - data.indexAcc.setValueOnly(ijk, std::min(prim.index, data.indexAcc.getValue(ijk))); + data.indexAcc.setValueOnly(ijk, (std::min)(prim.index, data.indexAcc.getValue(ijk))); } return !(dist > 0.75); // true if the primitive intersects the voxel. @@ -2532,7 +2532,7 @@ struct ExpandNarrowband // Gather neighbour information - CoordBBox bbox(Coord::max(), Coord::min()); + CoordBBox bbox((Coord::max)(), (Coord::min)()); for (typename BoolLeafNodeType::ValueOnIter it = maskNode.beginValueOn(); it; ++it) { bbox.expand(it.getCoord()); } @@ -2620,8 +2620,8 @@ struct ExpandNarrowband tree::ValueAccessor& distAcc, tree::ValueAccessor& indexAcc) { fragments.clear(); - const Coord nodeMin = bbox.min() & ~(LeafNodeType::DIM - 1); - const Coord nodeMax = bbox.max() & ~(LeafNodeType::DIM - 1); + const Coord nodeMin = (bbox.min)() & ~(LeafNodeType::DIM - 1); + const Coord nodeMax = (bbox.max)() & ~(LeafNodeType::DIM - 1); CoordBBox region; Coord ijk; @@ -2630,8 +2630,8 @@ struct ExpandNarrowband for (ijk[1] = nodeMin[1]; ijk[1] <= nodeMax[1]; ijk[1] += LeafNodeType::DIM) { for (ijk[2] = nodeMin[2]; ijk[2] <= nodeMax[2]; ijk[2] += LeafNodeType::DIM) { if (LeafNodeType* distleaf = distAcc.probeLeaf(ijk)) { - region.min() = Coord::maxComponent(bbox.min(), ijk); - region.max() = Coord::minComponent(bbox.max(), + (region.min)() = Coord::maxComponent((bbox.min)(), ijk); + (region.max)() = Coord::minComponent((bbox.max)(), ijk.offsetBy(LeafNodeType::DIM - 1)); gatherFragments(fragments, region, *distleaf, *indexAcc.probeLeaf(ijk)); } @@ -2650,11 +2650,11 @@ struct ExpandNarrowband const ValueType* distData = distLeaf.buffer().data(); const Int32* idxData = idxLeaf.buffer().data(); - for (int x = bbox.min()[0]; x <= bbox.max()[0]; ++x) { + for (int x = (bbox.min)()[0]; x <= (bbox.max)()[0]; ++x) { const Index xPos = (x & (LeafNodeType::DIM - 1u)) << (2 * LeafNodeType::LOG2DIM); - for (int y = bbox.min()[1]; y <= bbox.max()[1]; ++y) { + for (int y = (bbox.min)()[1]; y <= (bbox.max)()[1]; ++y) { const Index yPos = xPos + ((y & (LeafNodeType::DIM - 1u)) << LeafNodeType::LOG2DIM); - for (int z = bbox.min()[2]; z <= bbox.max()[2]; ++z) { + for (int z = (bbox.min)()[2]; z <= (bbox.max)()[2]; ++z) { const Index pos = yPos + (z & (LeafNodeType::DIM - 1u)); if (mask.isOn(pos)) { fragments.push_back(Fragment(idxData[pos],x,y,z, std::abs(distData[pos]))); @@ -2671,7 +2671,7 @@ struct ExpandNarrowband const std::vector& fragments, Int32& closestPrimIdx) const { Vec3d a, b, c, uvw, voxelCenter(ijk[0], ijk[1], ijk[2]); - double primDist, tmpDist, dist = std::numeric_limits::max(); + double primDist, tmpDist, dist = (std::numeric_limits::max)(); Int32 lastIdx = Int32(util::INVALID_IDX); for (size_t n = 0, N = fragments.size(); n < N; ++n) { @@ -3022,7 +3022,7 @@ struct MinCombine for (; iter; ++iter) { ValueType& val = const_cast(iter.getValue()); - val = std::min(val, bufferData[iter.pos()]); + val = (std::min)(val, bufferData[iter.pos()]); } } } @@ -3339,7 +3339,7 @@ meshToVolume( // Setup - GridTypePtr distGrid(new GridType(std::numeric_limits::max())); + GridTypePtr distGrid(new GridType((std::numeric_limits::max)())); distGrid->setTransform(transform.copy()); ValueType exteriorWidth = ValueType(exteriorBandWidth); @@ -3368,7 +3368,7 @@ meshToVolume( exteriorWidth *= voxelSize; // Avoid the unit conversion if the interior band width is set to // inf or std::numeric_limits::max(). - if (interiorWidth < std::numeric_limits::max()) { + if (interiorWidth < (std::numeric_limits::max)()) { interiorWidth *= voxelSize; } @@ -3534,11 +3534,11 @@ meshToVolume( } // Progress estimation - unsigned maxIterations = std::numeric_limits::max(); + unsigned maxIterations = (std::numeric_limits::max)(); float progress = 54.0f, step = 0.0f; double estimated = - 2.0 * std::ceil((std::max(interiorWidth, exteriorWidth) - minBandWidth) / voxelSize); + 2.0 * std::ceil(((std::max)(interiorWidth, exteriorWidth) - minBandWidth) / voxelSize); if (estimated < double(maxIterations)) { maxIterations = unsigned(estimated); @@ -3614,7 +3614,7 @@ meshToVolume( // Remove active voxels that exceed the narrow band limits - if (trimNarrowBand && std::min(interiorWidth, exteriorWidth) < voxelSize * ValueType(4.0)) { + if (trimNarrowBand && (std::min)(interiorWidth, exteriorWidth) < voxelSize * ValueType(4.0)) { std::vector nodes; nodes.reserve(distTree.leafCount()); @@ -4419,8 +4419,8 @@ createLevelSetBox(const math::BBox& bbox, const openvdb::math::Transform& xform, typename VecType::ValueType halfWidth) { - const Vec3s pmin = Vec3s(xform.worldToIndex(bbox.min())); - const Vec3s pmax = Vec3s(xform.worldToIndex(bbox.max())); + const Vec3s pmin = Vec3s(xform.worldToIndex((bbox.min)())); + const Vec3s pmax = Vec3s(xform.worldToIndex((bbox.max)())); Vec3s points[8]; points[0] = Vec3s(pmin[0], pmin[1], pmin[2]); diff --git a/Sources/OpenVDB/include/openvdb/tools/NodeVisitor.h b/Sources/OpenVDB/include/openvdb/tools/NodeVisitor.h index 857b1c38..78ef0bc9 100644 --- a/Sources/OpenVDB/include/openvdb/tools/NodeVisitor.h +++ b/Sources/OpenVDB/include/openvdb/tools/NodeVisitor.h @@ -130,8 +130,8 @@ namespace tools { /// if (iter.isValueOn()) /// { /// openvdb::CoordBBox b; -/// b.min() = iter.getCoord(); -/// b.max() = b.min().offsetBy(IterT::ChildNodeType::DIM); +/// (b.min)() = iter.getCoord(); +/// (b.max)() = (b.min)().offsetBy(IterT::ChildNodeType::DIM); /// /// processNodeBlock(b); /// } @@ -159,8 +159,8 @@ namespace tools { /// for (auto iter = node.beginValueOn(); iter; ++iter) /// { /// openvdb::CoordBBox b; -/// b.min() = iter.getCoord(); -/// b.max() = b.min().offsetBy(NodeT::ChildNodeType::DIM); +/// (b.min)() = iter.getCoord(); +/// (b.max)() = (b.min)().offsetBy(NodeT::ChildNodeType::DIM); /// /// processNodeBlock(b); /// } diff --git a/Sources/OpenVDB/include/openvdb/tools/ParticleAtlas.h b/Sources/OpenVDB/include/openvdb/tools/ParticleAtlas.h index 64739c17..1e857c1c 100644 --- a/Sources/OpenVDB/include/openvdb/tools/ParticleAtlas.h +++ b/Sources/OpenVDB/include/openvdb/tools/ParticleAtlas.h @@ -252,15 +252,15 @@ struct ComputeExtremas ComputeExtremas(const ParticleArrayT& particles) : particleArray(&particles) - , minRadius(std::numeric_limits::max()) - , maxRadius(-std::numeric_limits::max()) + , minRadius((std::numeric_limits::max)()) + , maxRadius(-(std::numeric_limits::max)()) { } ComputeExtremas(ComputeExtremas& rhs, tbb::split) : particleArray(rhs.particleArray) - , minRadius(std::numeric_limits::max()) - , maxRadius(-std::numeric_limits::max()) + , minRadius((std::numeric_limits::max)()) + , maxRadius(-(std::numeric_limits::max)()) { } @@ -270,17 +270,17 @@ struct ComputeExtremas for (size_t n = range.begin(), N = range.end(); n != N; ++n) { particleArray->getRadius(n, radius); - tmpMin = std::min(radius, tmpMin); - tmpMax = std::max(radius, tmpMax); + tmpMin = (std::min)(radius, tmpMin); + tmpMax = (std::max)(radius, tmpMax); } - minRadius = std::min(minRadius, tmpMin); - maxRadius = std::max(maxRadius, tmpMax); + minRadius = (std::min)(minRadius, tmpMin); + maxRadius = (std::max)(maxRadius, tmpMax); } void join(const ComputeExtremas& rhs) { - minRadius = std::min(minRadius, rhs.minRadius); - maxRadius = std::max(maxRadius, rhs.maxRadius); + minRadius = (std::min)(minRadius, rhs.minRadius); + maxRadius = (std::max)(maxRadius, rhs.maxRadius); } ParticleArrayT const * const particleArray; @@ -572,7 +572,7 @@ struct BBoxFilter const BBoxd& bbox, const ParticleArrayType& particles, bool hasUniformRadius = false) : mRanges(ranges) , mIndices(indices) - , mBBox(PosType(bbox.min()), PosType(bbox.max())) + , mBBox(PosType((bbox.min)()), PosType((bbox.max)())) , mCenter(mBBox.getCenter()) , mParticles(&particles) , mHasUniformRadius(hasUniformRadius) @@ -651,13 +651,13 @@ struct BBoxFilter const ScalarType a = pos[i]; - ScalarType b = mBBox.min()[i]; + ScalarType b = (mBBox.min)()[i]; if (a < b) { ScalarType delta = b - a; distSqr += delta * delta; } - b = mBBox.max()[i]; + b = (mBBox.max)()[i]; if (a > b) { ScalarType delta = a - b; distSqr += delta * delta; @@ -701,7 +701,7 @@ ParticleAtlas::construct( tbb::parallel_reduce(tbb::blocked_range(0, particles.size()), extremas); const double firstMin = extremas.minRadius; const double firstMax = extremas.maxRadius; - const double firstVoxelSize = std::max(minVoxelSize, firstMin); + const double firstVoxelSize = (std::max)(minVoxelSize, firstMin); if (!(firstMax < (firstVoxelSize * double(2.0))) && maxLevels > 1) { @@ -884,7 +884,7 @@ ParticleAtlas::Iterator::updateFromLevel(size_t level) this->clear(); if (mAccessorListSize > 0) { - const size_t levelIdx = std::min(mAccessorListSize - 1, level); + const size_t levelIdx = (std::min)(mAccessorListSize - 1, level); const TreeT& tree = mAtlas->pointIndexGrid(levelIdx).tree(); @@ -996,8 +996,8 @@ ParticleAtlas::Iterator::worldSpaceSearchAndUpdate( ConstAccessor& acc = *mAccessorList[n]; openvdb::CoordBBox inscribedRegion( - xform.worldToIndexCellCentered(bbox.min()), - xform.worldToIndexCellCentered(bbox.max())); + xform.worldToIndexCellCentered((bbox.min)()), + xform.worldToIndexCellCentered((bbox.max)())); inscribedRegion.expand(-1); // erode by one voxel @@ -1007,8 +1007,8 @@ ParticleAtlas::Iterator::worldSpaceSearchAndUpdate( searchRegions.clear(); const openvdb::CoordBBox region( - xform.worldToIndexCellCentered(bbox.min() - maxRadius), - xform.worldToIndexCellCentered(bbox.max() + maxRadius)); + xform.worldToIndexCellCentered((bbox.min)() - maxRadius), + xform.worldToIndexCellCentered((bbox.max)() + maxRadius)); inscribedRegion.expand(1); point_index_grid_internal::constructExclusiveRegions( diff --git a/Sources/OpenVDB/include/openvdb/tools/ParticlesToLevelSet.h b/Sources/OpenVDB/include/openvdb/tools/ParticlesToLevelSet.h index 030cb110..cf3dd449 100644 --- a/Sources/OpenVDB/include/openvdb/tools/ParticlesToLevelSet.h +++ b/Sources/OpenVDB/include/openvdb/tools/ParticlesToLevelSet.h @@ -813,7 +813,7 @@ struct ParticlesToLevelSet::Raster thread::cancelGroupExecution(); return false; } - const Coord &bmin = bbox.min(), &bmax = bbox.max(); + const Coord &bmin = (bbox.min)(), &bmax = (bbox.max)(); Coord c; Real cx, cy, cz; for (c = bmin, cx = c.x(); c.x() <= bmax.x(); ++c.x(), cx += 1) { diff --git a/Sources/OpenVDB/include/openvdb/tools/PointIndexGrid.h b/Sources/OpenVDB/include/openvdb/tools/PointIndexGrid.h index 68f13ab9..7341afcd 100644 --- a/Sources/OpenVDB/include/openvdb/tools/PointIndexGrid.h +++ b/Sources/OpenVDB/include/openvdb/tools/PointIndexGrid.h @@ -419,7 +419,7 @@ struct PopulateLeafNodesOp size_t maxPointCount = 0; for (size_t n = range.begin(), N = range.end(); n != N; ++n) { - maxPointCount = std::max(maxPointCount, mPartitioner->indices(n).size()); + maxPointCount = (std::max)(maxPointCount, mPartitioner->indices(n).size()); } const IndexT voxelCount = LeafNodeT::SIZE; @@ -543,16 +543,16 @@ constructExclusiveRegions(std::vector& regions, { regions.clear(); regions.reserve(6); - Coord cmin = ibox.min(); - Coord cmax = ibox.max(); + Coord cmin = (ibox.min)(); + Coord cmax = (ibox.max)(); // left-face bbox regions.push_back(bbox); - regions.back().max().z() = cmin.z(); + (regions.back().max)().z() = cmin.z(); // right-face bbox regions.push_back(bbox); - regions.back().min().z() = cmax.z(); + (regions.back().min)().z() = cmax.z(); --cmax.z(); // accounting for cell centered bucketing. ++cmin.z(); @@ -560,15 +560,15 @@ constructExclusiveRegions(std::vector& regions, // front-face bbox regions.push_back(bbox); CoordBBox* lastRegion = ®ions.back(); - lastRegion->min().z() = cmin.z(); - lastRegion->max().z() = cmax.z(); - lastRegion->max().x() = cmin.x(); + (lastRegion->min)().z() = cmin.z(); + (lastRegion->max)().z() = cmax.z(); + (lastRegion->max)().x() = cmin.x(); // back-face bbox regions.push_back(*lastRegion); lastRegion = ®ions.back(); - lastRegion->min().x() = cmax.x(); - lastRegion->max().x() = bbox.max().x(); + (lastRegion->min)().x() = cmax.x(); + (lastRegion->max)().x() = (bbox.max)().x(); --cmax.x(); ++cmin.x(); @@ -576,15 +576,15 @@ constructExclusiveRegions(std::vector& regions, // bottom-face bbox regions.push_back(*lastRegion); lastRegion = ®ions.back(); - lastRegion->min().x() = cmin.x(); - lastRegion->max().x() = cmax.x(); - lastRegion->max().y() = cmin.y(); + (lastRegion->min)().x() = cmin.x(); + (lastRegion->max)().x() = cmax.x(); + (lastRegion->max)().y() = cmin.y(); // top-face bbox regions.push_back(*lastRegion); lastRegion = ®ions.back(); - lastRegion->min().y() = cmax.y(); - lastRegion->max().y() = bbox.max().y(); + (lastRegion->min)().y() = cmax.y(); + (lastRegion->max)().y() = (bbox.max)().y(); } @@ -803,8 +803,8 @@ filteredPointIndexSearch(RangeFilterType& filter, ConstAccessor& acc, const Coor { using LeafNodeType = typename ConstAccessor::TreeType::LeafNodeType; Coord ijk(0), ijkMax(0), ijkA(0), ijkB(0); - const Coord leafMin = bbox.min() & ~(LeafNodeType::DIM - 1); - const Coord leafMax = bbox.max() & ~(LeafNodeType::DIM - 1); + const Coord leafMin = (bbox.min)() & ~(LeafNodeType::DIM - 1); + const Coord leafMax = (bbox.max)() & ~(LeafNodeType::DIM - 1); for (ijk[0] = leafMin[0]; ijk[0] <= leafMax[0]; ijk[0] += LeafNodeType::DIM) { for (ijk[1] = leafMin[1]; ijk[1] <= leafMax[1]; ijk[1] += LeafNodeType::DIM) { @@ -815,8 +815,8 @@ filteredPointIndexSearch(RangeFilterType& filter, ConstAccessor& acc, const Coor ijkMax.offset(LeafNodeType::DIM - 1); // intersect leaf bbox with search region. - ijkA = Coord::maxComponent(bbox.min(), ijk); - ijkB = Coord::minComponent(bbox.max(), ijkMax); + ijkA = Coord::maxComponent((bbox.min)(), ijk); + ijkB = Coord::minComponent((bbox.max)(), ijkMax); if (ijkA != ijk || ijkB != ijkMax) { filteredPointIndexSearchVoxels(filter, *leaf, ijkA, ijkB); @@ -882,8 +882,8 @@ pointIndexSearch(RangeDeque& rangeList, ConstAccessor& acc, const CoordBBox& bbo using Range = typename RangeDeque::value_type; Coord ijk(0), ijkMax(0), ijkA(0), ijkB(0); - const Coord leafMin = bbox.min() & ~(LeafNodeType::DIM - 1); - const Coord leafMax = bbox.max() & ~(LeafNodeType::DIM - 1); + const Coord leafMin = (bbox.min)() & ~(LeafNodeType::DIM - 1); + const Coord leafMax = (bbox.max)() & ~(LeafNodeType::DIM - 1); for (ijk[0] = leafMin[0]; ijk[0] <= leafMax[0]; ijk[0] += LeafNodeType::DIM) { for (ijk[1] = leafMin[1]; ijk[1] <= leafMax[1]; ijk[1] += LeafNodeType::DIM) { @@ -894,8 +894,8 @@ pointIndexSearch(RangeDeque& rangeList, ConstAccessor& acc, const CoordBBox& bbo ijkMax.offset(LeafNodeType::DIM - 1); // intersect leaf bbox with search region. - ijkA = Coord::maxComponent(bbox.min(), ijk); - ijkB = Coord::minComponent(bbox.max(), ijkMax); + ijkA = Coord::maxComponent((bbox.min)(), ijk); + ijkB = Coord::minComponent((bbox.max)(), ijkMax); if (ijkA != ijk || ijkB != ijkMax) { pointIndexSearchVoxels(rangeList, *leaf, ijkA, ijkB); @@ -1108,10 +1108,10 @@ PointIndexIterator::searchAndUpdate(const BBoxd& bbox, ConstAccessor& this->clear(); std::vector searchRegions; - CoordBBox region(Coord::round(bbox.min()), Coord::round(bbox.max())); + CoordBBox region(Coord::round((bbox.min)()), Coord::round((bbox.max)())); const Coord dim = region.dim(); - const int minExtent = std::min(dim[0], std::min(dim[1], dim[2])); + const int minExtent = (std::min)(dim[0], (std::min)(dim[1], dim[2])); if (minExtent > 2) { // collect indices that don't need to be tested @@ -1201,7 +1201,7 @@ PointIndexIterator::worldSpaceSearchAndUpdate(const BBoxd& bbox, Const const PointArray& points, const math::Transform& xform) { this->searchAndUpdate( - BBoxd(xform.worldToIndex(bbox.min()), xform.worldToIndex(bbox.max())), acc, points, xform); + BBoxd(xform.worldToIndex((bbox.min)()), xform.worldToIndex((bbox.max)())), acc, points, xform); } @@ -1696,15 +1696,15 @@ template inline bool PointIndexLeafNode::isEmpty(const CoordBBox& bbox) const { - Index xPos, pos, zStride = Index(bbox.max()[2] - bbox.min()[2]); + Index xPos, pos, zStride = Index((bbox.max)()[2] - (bbox.min)()[2]); Coord ijk; - for (ijk[0] = bbox.min()[0]; ijk[0] <= bbox.max()[0]; ++ijk[0]) { + for (ijk[0] = (bbox.min)()[0]; ijk[0] <= (bbox.max)()[0]; ++ijk[0]) { xPos = (ijk[0] & (DIM - 1u)) << (2 * LOG2DIM); - for (ijk[1] = bbox.min()[1]; ijk[1] <= bbox.max()[1]; ++ijk[1]) { + for (ijk[1] = (bbox.min)()[1]; ijk[1] <= (bbox.max)()[1]; ++ijk[1]) { pos = xPos + ((ijk[1] & (DIM - 1u)) << LOG2DIM); - pos += (bbox.min()[2] & (DIM - 1u)); + pos += ((bbox.min)()[2] & (DIM - 1u)); if (this->buffer()[pos+zStride] > (pos == 0 ? T(0) : this->buffer()[pos - 1])) { return false; diff --git a/Sources/OpenVDB/include/openvdb/tools/PointPartitioner.h b/Sources/OpenVDB/include/openvdb/tools/PointPartitioner.h index 069ed09d..b668f2ba 100644 --- a/Sources/OpenVDB/include/openvdb/tools/PointPartitioner.h +++ b/Sources/OpenVDB/include/openvdb/tools/PointPartitioner.h @@ -312,7 +312,7 @@ namespace openvdb PointIndexType pointCount = 0; for (size_t n(range.begin()), N(range.end()); n != N; ++n) { - pointCount = std::max(pointCount, (mPages[n + 1] - mPages[n])); + pointCount = (std::max)(pointCount, (mPages[n + 1] - mPages[n])); } const PointIndexType voxelCount = 1 << (3 * BucketLog2Dim); @@ -702,7 +702,7 @@ namespace openvdb size_t maxSegmentSize = 0; for (size_t n = range.begin(), N = range.end(); n != N; ++n) { - maxSegmentSize = std::max(maxSegmentSize, mIndexSegments[n]->size()); + maxSegmentSize = (std::max)(maxSegmentSize, mIndexSegments[n]->size()); } IndexArray bucketIndices(new PointIndexType[maxSegmentSize]); diff --git a/Sources/OpenVDB/include/openvdb/tools/PointScatter.h b/Sources/OpenVDB/include/openvdb/tools/PointScatter.h index 66f2b29d..2f0068b9 100644 --- a/Sources/OpenVDB/include/openvdb/tools/PointScatter.h +++ b/Sources/OpenVDB/include/openvdb/tools/PointScatter.h @@ -150,7 +150,7 @@ class UniformPointScatter : public BasePointScatterroot().evalActiveBoundingBox(mBBox, /*visit individual voxels*/false); - mBBox.max().offset(1);//padding so the bbox of a node becomes (origin,origin + node_dim) + (mBBox.max)().offset(1);//padding so the bbox of a node becomes (origin,origin + node_dim) } /// @brief Grid and BBox constructor diff --git a/Sources/OpenVDB/include/openvdb/tools/RayTracer.h b/Sources/OpenVDB/include/openvdb/tools/RayTracer.h index dc6092d2..a49f4b9c 100644 --- a/Sources/OpenVDB/include/openvdb/tools/RayTracer.h +++ b/Sources/OpenVDB/include/openvdb/tools/RayTracer.h @@ -438,7 +438,7 @@ class PerspectiveCamera: public BaseCamera double focalLength = 50.0, double aperture = 41.2136, double nearPlane = 1e-3, - double farPlane = std::numeric_limits::max()) + double farPlane = (std::numeric_limits::max)()) : BaseCamera(film, rotation, translation, 0.5*aperture/focalLength, nearPlane, farPlane) { } @@ -495,7 +495,7 @@ class OrthographicCamera: public BaseCamera const Vec3R& translation = Vec3R(0.0), double frameWidth = 1.0, double nearPlane = 1e-3, - double farPlane = std::numeric_limits::max()) + double farPlane = (std::numeric_limits::max)()) : BaseCamera(film, rotation, translation, 0.5*frameWidth, nearPlane, farPlane) { } @@ -638,7 +638,7 @@ class PositionShader: public BaseShader { public: PositionShader(const math::BBox& bbox, const GridT& grid) - : mMin(bbox.min()) + : mMin((bbox.min)()) , mInvDim(1.0/bbox.extents()) , mAcc(grid.getAccessor()) , mXform(&grid.transform()) @@ -667,7 +667,7 @@ class PositionShader: public BaseShader { public: PositionShader(const math::BBox& bbox, const Film::RGBA& c = Film::RGBA(1.0f)) - : mMin(bbox.min()), mInvDim(1.0/bbox.extents()), mRGBA(c) {} + : mMin((bbox.min)()), mInvDim(1.0/bbox.extents()), mRGBA(c) {} PositionShader(const PositionShader&) = default; ~PositionShader() override = default; Film::RGBA operator()(const Vec3R& xyz, const Vec3R&, const Vec3R&) const override diff --git a/Sources/OpenVDB/include/openvdb/tools/Statistics.h b/Sources/OpenVDB/include/openvdb/tools/Statistics.h index 5daa808d..82c28efc 100644 --- a/Sources/OpenVDB/include/openvdb/tools/Statistics.h +++ b/Sources/OpenVDB/include/openvdb/tools/Statistics.h @@ -320,9 +320,9 @@ struct MathOp CoordBBox bbox = it.getBoundingBox(); Coord xyz; int &x = xyz.x(), &y = xyz.y(), &z = xyz.z(); - for (x = bbox.min().x(); x <= bbox.max().x(); ++x) { - for (y = bbox.min().y(); y <= bbox.max().y(); ++y) { - for (z = bbox.min().z(); z <= bbox.max().z(); ++z) { + for (x = (bbox.min)().x(); x <= (bbox.max)().x(); ++x) { + for (y = (bbox.min)().y(); y <= (bbox.max)().y(); ++y) { + for (z = (bbox.min)().z(); z <= (bbox.max)().z(); ++z) { mStats.add(mOp.result(mAcc, it.getCoord())); } } diff --git a/Sources/OpenVDB/include/openvdb/tools/TopologyToLevelSet.h b/Sources/OpenVDB/include/openvdb/tools/TopologyToLevelSet.h index 703156db..c023d947 100644 --- a/Sources/OpenVDB/include/openvdb/tools/TopologyToLevelSet.h +++ b/Sources/OpenVDB/include/openvdb/tools/TopologyToLevelSet.h @@ -114,7 +114,7 @@ struct OffsetAndMinComp auto* const data = lhsNode.buffer().data(); for (Iterator it = lhsNode.beginValueOn(); it; ++it) { ValueType& val = data[it.pos()]; - val = std::min(val, offset + rhsNodePt->getValue(it.pos())); + val = (std::min)(val, offset + rhsNodePt->getValue(it.pos())); } } } @@ -184,9 +184,9 @@ topologyToLevelSet(const GridT& grid, int halfWidth, int closingSteps, int dilat // Check inputs - halfWidth = std::max(halfWidth, 1); - closingSteps = std::max(closingSteps, 0); - dilation = std::max(dilation, 0); + halfWidth = (std::max)(halfWidth, 1); + closingSteps = (std::max)(closingSteps, 0); + dilation = (std::max)(dilation, 0); if (!grid.hasUniformVoxels()) { OPENVDB_THROW(ValueError, "Non-uniform voxels are not supported!"); diff --git a/Sources/OpenVDB/include/openvdb/tools/VolumeAdvect.h b/Sources/OpenVDB/include/openvdb/tools/VolumeAdvect.h index fee18db3..f245f4c9 100644 --- a/Sources/OpenVDB/include/openvdb/tools/VolumeAdvect.h +++ b/Sources/OpenVDB/include/openvdb/tools/VolumeAdvect.h @@ -93,7 +93,7 @@ class VolumeAdvection { math::Extrema e = extrema(velGrid.cbeginValueAll(), /*threading*/true); e.add(velGrid.background().length()); - mMaxVelocity = e.max(); + mMaxVelocity = (e.max)(); } virtual ~VolumeAdvection() diff --git a/Sources/OpenVDB/include/openvdb/tools/VolumeToMesh.h b/Sources/OpenVDB/include/openvdb/tools/VolumeToMesh.h index 9fc85e04..6ee940c1 100644 --- a/Sources/OpenVDB/include/openvdb/tools/VolumeToMesh.h +++ b/Sources/OpenVDB/include/openvdb/tools/VolumeToMesh.h @@ -343,8 +343,8 @@ inline Vec3d findFeaturePoint( Mat3d D = Mat3d::identity(); - double tolerance = std::max(std::abs(eigenValues[0]), std::abs(eigenValues[1])); - tolerance = std::max(tolerance, std::abs(eigenValues[2])); + double tolerance = (std::max)(std::abs(eigenValues[0]), std::abs(eigenValues[1])); + tolerance = (std::max)(tolerance, std::abs(eigenValues[2])); tolerance *= 0.01; int clamped = 0; @@ -1334,8 +1334,8 @@ computeWeightedPoint(const Vec3d& p, double maxWeight = weights.front(); for (size_t i = 1, I = weights.size(); i < I; ++i) { - minWeight = std::min(minWeight, weights[i]); - maxWeight = std::max(maxWeight, weights[i]); + minWeight = (std::min)(minWeight, weights[i]); + maxWeight = (std::max)(maxWeight, weights[i]); } const double offset = maxWeight + minWeight * 0.1; @@ -2655,20 +2655,20 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran const Vec4i& tile = mTileArray[n]; - bbox.min()[0] = tile[0]; - bbox.min()[1] = tile[1]; - bbox.min()[2] = tile[2]; - bbox.max() = bbox.min(); - bbox.max().offset(tile[3]); + (bbox.min)()[0] = tile[0]; + (bbox.min)()[1] = tile[1]; + (bbox.min)()[2] = tile[2]; + (bbox.max)() = (bbox.min)(); + (bbox.max)().offset(tile[3]); InputValueType value = mInputTree->background(); - const bool isInside = isInsideValue(inputTreeAcc.getValue(bbox.min()), mIsovalue); - const int valueDepth = inputTreeAcc.getValueDepth(bbox.min()); + const bool isInside = isInsideValue(inputTreeAcc.getValue((bbox.min)()), mIsovalue); + const int valueDepth = inputTreeAcc.getValueDepth((bbox.min)()); // eval x-edges - ijk = bbox.max(); + ijk = (bbox.max)(); nijk = ijk; ++nijk[0]; @@ -2680,12 +2680,12 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran if (processRegion) { region = bbox; region.expand(1); - region.min()[0] = region.max()[0] = ijk[0]; + (region.min)()[0] = (region.max)()[0] = ijk[0]; mMask->fill(region, false); } - ijk = bbox.min(); + ijk = (bbox.min)(); --ijk[0]; processRegion = true; @@ -2697,14 +2697,14 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran if (processRegion) { region = bbox; region.expand(1); - region.min()[0] = region.max()[0] = ijk[0]; + (region.min)()[0] = (region.max)()[0] = ijk[0]; mMask->fill(region, false); } // eval y-edges - ijk = bbox.max(); + ijk = (bbox.max)(); nijk = ijk; ++nijk[1]; @@ -2716,12 +2716,12 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran if (processRegion) { region = bbox; region.expand(1); - region.min()[1] = region.max()[1] = ijk[1]; + (region.min)()[1] = (region.max)()[1] = ijk[1]; mMask->fill(region, false); } - ijk = bbox.min(); + ijk = (bbox.min)(); --ijk[1]; processRegion = true; @@ -2733,14 +2733,14 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran if (processRegion) { region = bbox; region.expand(1); - region.min()[1] = region.max()[1] = ijk[1]; + (region.min)()[1] = (region.max)()[1] = ijk[1]; mMask->fill(region, false); } // eval z-edges - ijk = bbox.max(); + ijk = (bbox.max)(); nijk = ijk; ++nijk[2]; @@ -2752,11 +2752,11 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran if (processRegion) { region = bbox; region.expand(1); - region.min()[2] = region.max()[2] = ijk[2]; + (region.min)()[2] = (region.max)()[2] = ijk[2]; mMask->fill(region, false); } - ijk = bbox.min(); + ijk = (bbox.min)(); --ijk[2]; processRegion = true; @@ -2768,7 +2768,7 @@ MaskTileBorders::operator()(const tbb::blocked_range& ran if (processRegion) { region = bbox; region.expand(1); - region.min()[2] = region.max()[2] = ijk[2]; + (region.min)()[2] = (region.max)()[2] = ijk[2]; mMask->fill(region, false); } } @@ -2801,10 +2801,10 @@ maskActiveTileBorders(const InputTreeType& inputTree, for (; tileIter; ++tileIter) { Vec4i& tile = tiles[index++]; tileIter.getBoundingBox(bbox); - tile[0] = bbox.min()[0]; - tile[1] = bbox.min()[1]; - tile[2] = bbox.min()[2]; - tile[3] = bbox.max()[0] - bbox.min()[0]; + tile[0] = (bbox.min)()[0]; + tile[1] = (bbox.min)()[1]; + tile[2] = (bbox.min)()[2]; + tile[3] = (bbox.max)()[0] - (bbox.min)()[0]; } MaskTileBorders op(inputTree, iso, mask, tiles.get()); @@ -3745,11 +3745,11 @@ ComputeAuxiliaryData::ComputeAuxiliaryData( , mIntersectionNodes(intersectionLeafNodes.data()) , mSignFlagsTree(0) , mSignFlagsAccessor(signFlagsTree) - , mPointIndexTree(std::numeric_limits::max()) + , mPointIndexTree((std::numeric_limits::max)()) , mPointIndexAccessor(pointIndexTree) , mIsovalue(iso) { - pointIndexTree.root().setBackground(std::numeric_limits::max(), false); + pointIndexTree.root().setBackground((std::numeric_limits::max)(), false); } @@ -3759,7 +3759,7 @@ ComputeAuxiliaryData::ComputeAuxiliaryData(ComputeAuxiliaryData& , mIntersectionNodes(rhs.mIntersectionNodes) , mSignFlagsTree(0) , mSignFlagsAccessor(mSignFlagsTree) - , mPointIndexTree(std::numeric_limits::max()) + , mPointIndexTree((std::numeric_limits::max)()) , mPointIndexAccessor(mPointIndexTree) , mIsovalue(rhs.mIsovalue) { @@ -4928,7 +4928,7 @@ VolumeToMesh::operator()(const InputGridType& inputGrid) } Int16TreeType signFlagsTree(0); - Index32TreeType pointIndexTree(std::numeric_limits::max()); + Index32TreeType pointIndexTree((std::numeric_limits::max)()); // collect auxiliary data @@ -4972,7 +4972,7 @@ VolumeToMesh::operator()(const InputGridType& inputGrid) typename Int16TreeType::Ptr refSignFlagsTreePt(new Int16TreeType(0)); typename Index32TreeType::Ptr refPointIndexTreePt( - new Index32TreeType(std::numeric_limits::max())); + new Index32TreeType((std::numeric_limits::max)())); BoolTreeType refIntersectionTree(false); diff --git a/Sources/OpenVDB/include/openvdb/tools/VolumeToSpheres.h b/Sources/OpenVDB/include/openvdb/tools/VolumeToSpheres.h index 71fb5cf4..64fd7caa 100644 --- a/Sources/OpenVDB/include/openvdb/tools/VolumeToSpheres.h +++ b/Sources/OpenVDB/include/openvdb/tools/VolumeToSpheres.h @@ -65,7 +65,7 @@ fillWithSpheres( const Vec2i& sphereCount = Vec2i(1, 50), bool overlapping = false, float minRadius = 1.0, - float maxRadius = std::numeric_limits::max(), + float maxRadius = (std::numeric_limits::max)(), float isovalue = 0.0, int instanceCount = 10000, InterrupterT* interrupter = nullptr); @@ -453,7 +453,7 @@ ClosestPointDist::evalNode(size_t pointIndex, size_t nodeIndex) co center[2] = mLeafBoundingSpheres[i][2]; const auto radiusSqr = mLeafBoundingSpheres[i][3]; - distToLeaf = float(std::max(0.0, (pos - center).lengthSqr() - radiusSqr)); + distToLeaf = float((std::max)(0.0, (pos - center).lengthSqr() - radiusSqr)); if (distToLeaf < minDist) { minDist = distToLeaf; @@ -495,7 +495,7 @@ ClosestPointDist::operator()(const tbb::blocked_range& ran center[2] = mNodeBoundingSpheres[i][2]; const auto radiusSqr = mNodeBoundingSpheres[i][3]; - distToNode = float(std::max(0.0, (pos - center).lengthSqr() - radiusSqr)); + distToNode = float((std::max)(0.0, (pos - center).lengthSqr() - radiusSqr)); if (distToNode < minDist) { minDist = distToNode; @@ -612,7 +612,7 @@ UpdatePoints::operator()(const tbb::blocked_range& range) } if (!mOverlapping) { - mDistances[n] = std::min(mDistances[n], (dist - mSphere[3])); + mDistances[n] = (std::min)(mDistances[n], (dist - mSphere[3])); } if (mDistances[n] > mRadius) { @@ -665,7 +665,7 @@ fillWithSpheres( // have values less than or equal to the background value, so an isovalue // greater than or equal to the background value would produce a mask with // effectively infinite extent.) - isovalue = std::min(isovalue, + isovalue = (std::min)(isovalue, static_cast(gridPtr->background() - math::Tolerance::value())); } else if (gridPtr->getGridClass() == GRID_FOG_VOLUME) { // Clamp the isovalue of a fog volume between epsilon and one, @@ -696,7 +696,7 @@ fillWithSpheres( } const bool addNarrowBandPoints = (numVoxels < 10000); - int instances = std::max(instanceCount, maxSphereCount); + int instances = (std::max)(instanceCount, maxSphereCount); using TreeT = typename GridT::TreeType; using BoolTreeT = typename TreeT::template ValueConverter::Type; @@ -792,11 +792,11 @@ fillWithSpheres( minRadius = float(minRadius * transform.voxelSize()[0]); maxRadius = float(maxRadius * transform.voxelSize()[0]); - for (size_t s = 0, S = std::min(size_t(maxSphereCount), instancePoints.size()); s < S; ++s) { + for (size_t s = 0, S = (std::min)(size_t(maxSphereCount), instancePoints.size()); s < S; ++s) { if (interrupter && interrupter->wasInterrupted()) return; - largestRadius = std::min(maxRadius, largestRadius); + largestRadius = (std::min)(maxRadius, largestRadius); if ((int(s) >= minSphereCount) && (largestRadius < minRadius)) break; @@ -851,7 +851,7 @@ ClosestSurfacePoint::initialize( volume_to_mesh_internal::identifySurfaceIntersectingVoxels(mask, tree, ValueT(isovalue)); mSignTreePt.reset(new Int16TreeT(0)); - mIdxTreePt.reset(new Index32TreeT(std::numeric_limits::max())); + mIdxTreePt.reset(new Index32TreeT((std::numeric_limits::max)())); volume_to_mesh_internal::computeAuxiliaryData( @@ -936,7 +936,7 @@ ClosestSurfacePoint::initialize( ++leafCount; } - mMaxNodeLeafs = std::max(leafCount, mMaxNodeLeafs); + mMaxNodeLeafs = (std::max)(leafCount, mMaxNodeLeafs); mLeafRanges[n].second = mLeafNodes.size(); } diff --git a/Sources/OpenVDB/include/openvdb/tree/InternalNode.h b/Sources/OpenVDB/include/openvdb/tree/InternalNode.h index 913db4a5..88135761 100644 --- a/Sources/OpenVDB/include/openvdb/tree/InternalNode.h +++ b/Sources/OpenVDB/include/openvdb/tree/InternalNode.h @@ -2040,11 +2040,11 @@ InternalNode::fill(const CoordBBox& bbox, const ValueType& valu // Iterate over the fill region in axis-aligned, tile-sized chunks. // (The first and last chunks along each axis might be smaller than a tile.) Coord xyz, tileMin, tileMax; - for (int x = clippedBBox.min().x(); x <= clippedBBox.max().x(); x = tileMax.x() + 1) { + for (int x = (clippedBBox.min)().x(); x <= (clippedBBox.max)().x(); x = tileMax.x() + 1) { xyz.setX(x); - for (int y = clippedBBox.min().y(); y <= clippedBBox.max().y(); y = tileMax.y() + 1) { + for (int y = (clippedBBox.min)().y(); y <= (clippedBBox.max)().y(); y = tileMax.y() + 1) { xyz.setY(y); - for (int z = clippedBBox.min().z(); z <= clippedBBox.max().z(); z = tileMax.z() + 1) { + for (int z = (clippedBBox.min)().z(); z <= (clippedBBox.max)().z(); z = tileMax.z() + 1) { xyz.setZ(z); // Get the bounds of the tile that contains voxel (x, y, z). @@ -2052,8 +2052,8 @@ InternalNode::fill(const CoordBBox& bbox, const ValueType& valu tileMin = this->offsetToGlobalCoord(n); tileMax = tileMin.offsetBy(ChildT::DIM - 1); - if (xyz != tileMin || Coord::lessThan(clippedBBox.max(), tileMax)) { - // If the box defined by (xyz, clippedBBox.max()) doesn't completely enclose + if (xyz != tileMin || Coord::lessThan((clippedBBox.max)(), tileMax)) { + // If the box defined by (xyz, (clippedBBox.max)()) doesn't completely enclose // the tile to which xyz belongs, create a child node (or retrieve // the existing one). ChildT* child = nullptr; @@ -2068,12 +2068,12 @@ InternalNode::fill(const CoordBBox& bbox, const ValueType& valu // Forward the fill request to the child. if (child) { - const Coord tmp = Coord::minComponent(clippedBBox.max(), tileMax); + const Coord tmp = Coord::minComponent((clippedBBox.max)(), tileMax); child->fill(CoordBBox(xyz, tmp), value, active); } } else { - // If the box given by (xyz, clippedBBox.max()) completely encloses + // If the box given by (xyz, (clippedBBox.max)()) completely encloses // the tile to which xyz belongs, create the tile (if it // doesn't already exist) and give it the fill value. this->makeChildNodeEmpty(n, value); @@ -2096,11 +2096,11 @@ InternalNode::denseFill(const CoordBBox& bbox, const ValueType& // Iterate over the fill region in axis-aligned, tile-sized chunks. // (The first and last chunks along each axis might be smaller than a tile.) Coord xyz, tileMin, tileMax; - for (int x = clippedBBox.min().x(); x <= clippedBBox.max().x(); x = tileMax.x() + 1) { + for (int x = (clippedBBox.min)().x(); x <= (clippedBBox.max)().x(); x = tileMax.x() + 1) { xyz.setX(x); - for (int y = clippedBBox.min().y(); y <= clippedBBox.max().y(); y = tileMax.y() + 1) { + for (int y = (clippedBBox.min)().y(); y <= (clippedBBox.max)().y(); y = tileMax.y() + 1) { xyz.setY(y); - for (int z = clippedBBox.min().z(); z <= clippedBBox.max().z(); z = tileMax.z() + 1) { + for (int z = (clippedBBox.min)().z(); z <= (clippedBBox.max)().z(); z = tileMax.z() + 1) { xyz.setZ(z); // Get the table index of the tile that contains voxel (x, y, z). @@ -2122,7 +2122,7 @@ InternalNode::denseFill(const CoordBBox& bbox, const ValueType& tileMax = tileMin.offsetBy(ChildT::DIM - 1); // Forward the fill request to the child. - child->denseFill(CoordBBox{xyz, clippedBBox.max()}, value, active); + child->denseFill(CoordBBox{xyz, (clippedBBox.max)()}, value, active); } } } @@ -2140,28 +2140,28 @@ InternalNode::copyToDense(const CoordBBox& bbox, DenseT& dense) using DenseValueType = typename DenseT::ValueType; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); - for (Coord xyz = bbox.min(), max; xyz[0] <= bbox.max()[0]; xyz[0] = max[0] + 1) { - for (xyz[1] = bbox.min()[1]; xyz[1] <= bbox.max()[1]; xyz[1] = max[1] + 1) { - for (xyz[2] = bbox.min()[2]; xyz[2] <= bbox.max()[2]; xyz[2] = max[2] + 1) { + const Coord& min = (dense.bbox().min)(); + for (Coord xyz = (bbox.min)(), max; xyz[0] <= (bbox.max)()[0]; xyz[0] = max[0] + 1) { + for (xyz[1] = (bbox.min)()[1]; xyz[1] <= (bbox.max)()[1]; xyz[1] = max[1] + 1) { + for (xyz[2] = (bbox.min)()[2]; xyz[2] <= (bbox.max)()[2]; xyz[2] = max[2] + 1) { const Index n = this->coordToOffset(xyz); // Get max coordinates of the child node that contains voxel xyz. max = this->offsetToGlobalCoord(n).offsetBy(ChildT::DIM-1); // Get the bbox of the interection of bbox and the child node - CoordBBox sub(xyz, Coord::minComponent(bbox.max(), max)); + CoordBBox sub(xyz, Coord::minComponent((bbox.max)(), max)); if (this->isChildMaskOn(n)) {//is a child mNodes[n].getChild()->copyToDense(sub, dense); } else {//a tile value const ValueType value = mNodes[n].getValue(); sub.translate(-min); - DenseValueType* a0 = dense.data() + zStride*sub.min()[2]; - for (Int32 x=sub.min()[0], ex=sub.max()[0]+1; x mAuxBuffersPerLeaf) return false; if (b1 == 0) { if (this->isConstTree()) return false; diff --git a/Sources/OpenVDB/include/openvdb/tree/LeafNode.h b/Sources/OpenVDB/include/openvdb/tree/LeafNode.h index e520aa7a..3c4478ee 100644 --- a/Sources/OpenVDB/include/openvdb/tree/LeafNode.h +++ b/Sources/OpenVDB/include/openvdb/tree/LeafNode.h @@ -1149,9 +1149,9 @@ LeafNode::clip(const CoordBBox& clipBBox, const T& background) nodeBBox.intersect(clipBBox); Coord xyz; int &x = xyz.x(), &y = xyz.y(), &z = xyz.z(); - for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) { - for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) { - for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) { + for (x = (nodeBBox.min)().x(); x <= (nodeBBox.max)().x(); ++x) { + for (y = (nodeBBox.min)().y(); y <= (nodeBBox.max)().y(); ++y) { + for (z = (nodeBBox.min)().z(); z <= (nodeBBox.max)().z(); ++z) { mask.setOn(static_cast(this->coordToOffset(xyz))); } } @@ -1178,11 +1178,11 @@ LeafNode::fill(const CoordBBox& bbox, const ValueType& value, bool a clippedBBox.intersect(bbox); if (!clippedBBox) return; - for (Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) { + for (Int32 x = (clippedBBox.min)().x(); x <= (clippedBBox.max)().x(); ++x) { const Index offsetX = (x & (DIM-1u)) << 2*Log2Dim; - for (Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) { + for (Int32 y = (clippedBBox.min)().y(); y <= (clippedBBox.max)().y(); ++y) { const Index offsetXY = offsetX + ((y & (DIM-1u)) << Log2Dim); - for (Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) { + for (Int32 z = (clippedBBox.min)().z(); z <= (clippedBBox.max)().z(); ++z) { const Index offset = offsetXY + (z & (DIM-1u)); mBuffer[offset] = value; mValueMask.set(offset, active); @@ -1220,16 +1220,16 @@ LeafNode::copyToDense(const CoordBBox& bbox, DenseT& dense) const using DenseValueType = typename DenseT::ValueType; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); - DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // target array - const T* s0 = &mBuffer[bbox.min()[2] & (DIM-1u)]; // source array - for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) { + const Coord& min = (dense.bbox().min)(); + DenseValueType* t0 = dense.data() + zStride * ((bbox.min)()[2] - min[2]); // target array + const T* s0 = &mBuffer[(bbox.min)()[2] & (DIM-1u)]; // source array + for (Int32 x = (bbox.min)()[0], ex = (bbox.max)()[0] + 1; x < ex; ++x) { DenseValueType* t1 = t0 + xStride * (x - min[0]); const T* s1 = s0 + ((x & (DIM-1u)) << 2*Log2Dim); - for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) { + for (Int32 y = (bbox.min)()[1], ey = (bbox.max)()[1] + 1; y < ey; ++y) { DenseValueType* t2 = t1 + yStride * (y - min[1]); const T* s2 = s1 + ((y & (DIM-1u)) << Log2Dim); - for (Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) { + for (Int32 z = (bbox.min)()[2], ez = (bbox.max)()[2] + 1; z < ez; ++z, t2 += zStride) { *t2 = DenseValueType(*s2++); } } @@ -1248,17 +1248,17 @@ LeafNode::copyFromDense(const CoordBBox& bbox, const DenseT& dense, using DenseValueType = typename DenseT::ValueType; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); + const Coord& min = (dense.bbox().min)(); - const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // source - const Int32 n0 = bbox.min()[2] & (DIM-1u); - for (Int32 x = bbox.min()[0], ex = bbox.max()[0]+1; x < ex; ++x) { + const DenseValueType* s0 = dense.data() + zStride * ((bbox.min)()[2] - min[2]); // source + const Int32 n0 = (bbox.min)()[2] & (DIM-1u); + for (Int32 x = (bbox.min)()[0], ex = (bbox.max)()[0]+1; x < ex; ++x) { const DenseValueType* s1 = s0 + xStride * (x - min[0]); const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM); - for (Int32 y = bbox.min()[1], ey = bbox.max()[1]+1; y < ey; ++y) { + for (Int32 y = (bbox.min)()[1], ey = (bbox.max)()[1]+1; y < ey; ++y) { const DenseValueType* s2 = s1 + yStride * (y - min[1]); Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM); - for (Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) { + for (Int32 z = (bbox.min)()[2], ez = (bbox.max)()[2]+1; z < ez; ++z, ++n2, s2 += zStride) { if (math::isApproxEqual(background, ValueType(*s2), tolerance)) { mValueMask.setOff(n2); mBuffer[n2] = background; diff --git a/Sources/OpenVDB/include/openvdb/tree/LeafNodeBool.h b/Sources/OpenVDB/include/openvdb/tree/LeafNodeBool.h index 840a1de1..94e14f59 100644 --- a/Sources/OpenVDB/include/openvdb/tree/LeafNodeBool.h +++ b/Sources/OpenVDB/include/openvdb/tree/LeafNodeBool.h @@ -1406,9 +1406,9 @@ LeafNode::clip(const CoordBBox& clipBBox, bool background) nodeBBox.intersect(clipBBox); Coord xyz; int &x = xyz.x(), &y = xyz.y(), &z = xyz.z(); - for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) { - for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) { - for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) { + for (x = (nodeBBox.min)().x(); x <= (nodeBBox.max)().x(); ++x) { + for (y = (nodeBBox.min)().y(); y <= (nodeBBox.max)().y(); ++y) { + for (z = (nodeBBox.min)().z(); z <= (nodeBBox.max)().z(); ++z) { mask.setOn(static_cast(this->coordToOffset(xyz))); } } @@ -1433,11 +1433,11 @@ LeafNode::fill(const CoordBBox& bbox, bool value, bool active) clippedBBox.intersect(bbox); if (!clippedBBox) return; - for (Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) { + for (Int32 x = (clippedBBox.min)().x(); x <= (clippedBBox.max)().x(); ++x) { const Index offsetX = (x & (DIM-1u))<<2*Log2Dim; - for (Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) { + for (Int32 y = (clippedBBox.min)().y(); y <= (clippedBBox.max)().y(); ++y) { const Index offsetXY = offsetX + ((y & (DIM-1u))<< Log2Dim); - for (Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) { + for (Int32 z = (clippedBBox.min)().z(); z <= (clippedBBox.max)().z(); ++z) { const Index offset = offsetXY + (z & (DIM-1u)); mValueMask.set(offset, active); mBuffer.mData.set(offset, value); @@ -1473,16 +1473,16 @@ LeafNode::copyToDense(const CoordBBox& bbox, DenseT& dense) const using DenseValueType = typename DenseT::ValueType; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); - DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // target array - const Int32 n0 = bbox.min()[2] & (DIM-1u); - for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) { + const Coord& min = (dense.bbox().min)(); + DenseValueType* t0 = dense.data() + zStride * ((bbox.min)()[2] - min[2]); // target array + const Int32 n0 = (bbox.min)()[2] & (DIM-1u); + for (Int32 x = (bbox.min)()[0], ex = (bbox.max)()[0] + 1; x < ex; ++x) { DenseValueType* t1 = t0 + xStride * (x - min[0]); const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM); - for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) { + for (Int32 y = (bbox.min)()[1], ey = (bbox.max)()[1] + 1; y < ey; ++y) { DenseValueType* t2 = t1 + yStride * (y - min[1]); Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM); - for (Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) { + for (Int32 z = (bbox.min)()[2], ez = (bbox.max)()[2] + 1; z < ez; ++z, t2 += zStride) { *t2 = DenseValueType(mBuffer.mData.isOn(n2++)); } } @@ -1502,16 +1502,16 @@ LeafNode::copyFromDense(const CoordBBox& bbox, const DenseT& dens }; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); - const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // source - const Int32 n0 = bbox.min()[2] & (DIM-1u); - for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) { + const Coord& min = (dense.bbox().min)(); + const DenseValueType* s0 = dense.data() + zStride * ((bbox.min)()[2] - min[2]); // source + const Int32 n0 = (bbox.min)()[2] & (DIM-1u); + for (Int32 x = (bbox.min)()[0], ex = (bbox.max)()[0] + 1; x < ex; ++x) { const DenseValueType* s1 = s0 + xStride * (x - min[0]); const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM); - for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) { + for (Int32 y = (bbox.min)()[1], ey = (bbox.max)()[1] + 1; y < ey; ++y) { const DenseValueType* s2 = s1 + yStride * (y - min[1]); Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM); - for (Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) { + for (Int32 z = (bbox.min)()[2], ez = (bbox.max)()[2]+1; z < ez; ++z, ++n2, s2 += zStride) { // Note: if tolerance is true (i.e., 1), then all boolean values compare equal. if (tolerance || (background == Local::toBool(*s2))) { mValueMask.setOff(n2); diff --git a/Sources/OpenVDB/include/openvdb/tree/LeafNodeMask.h b/Sources/OpenVDB/include/openvdb/tree/LeafNodeMask.h index 132157ea..00e7aa53 100644 --- a/Sources/OpenVDB/include/openvdb/tree/LeafNodeMask.h +++ b/Sources/OpenVDB/include/openvdb/tree/LeafNodeMask.h @@ -1292,9 +1292,9 @@ LeafNode::clip(const CoordBBox& clipBBox, bool background) nodeBBox.intersect(clipBBox); Coord xyz; int &x = xyz.x(), &y = xyz.y(), &z = xyz.z(); - for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) { - for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) { - for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) { + for (x = (nodeBBox.min)().x(); x <= (nodeBBox.max)().x(); ++x) { + for (y = (nodeBBox.min)().y(); y <= (nodeBBox.max)().y(); ++y) { + for (z = (nodeBBox.min)().z(); z <= (nodeBBox.max)().z(); ++z) { mask.setOn(static_cast(this->coordToOffset(xyz))); } } @@ -1319,11 +1319,11 @@ LeafNode::fill(const CoordBBox& bbox, bool value, bool) clippedBBox.intersect(bbox); if (!clippedBBox) return; - for (Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) { + for (Int32 x = (clippedBBox.min)().x(); x <= (clippedBBox.max)().x(); ++x) { const Index offsetX = (x & (DIM-1u))<<2*Log2Dim; - for (Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) { + for (Int32 y = (clippedBBox.min)().y(); y <= (clippedBBox.max)().y(); ++y) { const Index offsetXY = offsetX + ((y & (DIM-1u))<< Log2Dim); - for (Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) { + for (Int32 z = (clippedBBox.min)().z(); z <= (clippedBBox.max)().z(); ++z) { const Index offset = offsetXY + (z & (DIM-1u)); mBuffer.mData.set(offset, value); } @@ -1350,16 +1350,16 @@ LeafNode::copyToDense(const CoordBBox& bbox, DenseT& dense) using DenseValueType = typename DenseT::ValueType; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); - DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // target array - const Int32 n0 = bbox.min()[2] & (DIM-1u); - for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) { + const Coord& min = (dense.bbox().min)(); + DenseValueType* t0 = dense.data() + zStride * ((bbox.min)()[2] - min[2]); // target array + const Int32 n0 = (bbox.min)()[2] & (DIM-1u); + for (Int32 x = (bbox.min)()[0], ex = (bbox.max)()[0] + 1; x < ex; ++x) { DenseValueType* t1 = t0 + xStride * (x - min[0]); const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM); - for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) { + for (Int32 y = (bbox.min)()[1], ey = (bbox.max)()[1] + 1; y < ey; ++y) { DenseValueType* t2 = t1 + yStride * (y - min[1]); Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM); - for (Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) { + for (Int32 z = (bbox.min)()[2], ez = (bbox.max)()[2] + 1; z < ez; ++z, t2 += zStride) { *t2 = DenseValueType(mBuffer.mData.isOn(n2++)); } } @@ -1379,16 +1379,16 @@ LeafNode::copyFromDense(const CoordBBox& bbox, const DenseT& }; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); - const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // source - const Int32 n0 = bbox.min()[2] & (DIM-1u); - for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) { + const Coord& min = (dense.bbox().min)(); + const DenseValueType* s0 = dense.data() + zStride * ((bbox.min)()[2] - min[2]); // source + const Int32 n0 = (bbox.min)()[2] & (DIM-1u); + for (Int32 x = (bbox.min)()[0], ex = (bbox.max)()[0] + 1; x < ex; ++x) { const DenseValueType* s1 = s0 + xStride * (x - min[0]); const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM); - for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) { + for (Int32 y = (bbox.min)()[1], ey = (bbox.max)()[1] + 1; y < ey; ++y) { const DenseValueType* s2 = s1 + yStride * (y - min[1]); Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM); - for (Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) { + for (Int32 z = (bbox.min)()[2], ez = (bbox.max)()[2]+1; z < ez; ++z, ++n2, s2 += zStride) { // Note: if tolerance is true (i.e., 1), then all boolean values compare equal. if (tolerance || (background == Local::toBool(*s2))) { mBuffer.mData.set(n2, background); diff --git a/Sources/OpenVDB/include/openvdb/tree/RootNode.h b/Sources/OpenVDB/include/openvdb/tree/RootNode.h index ebdd7e6f..1e4ebb6d 100644 --- a/Sources/OpenVDB/include/openvdb/tree/RootNode.h +++ b/Sources/OpenVDB/include/openvdb/tree/RootNode.h @@ -1380,8 +1380,8 @@ template inline void RootNode::getIndexRange(CoordBBox& bbox) const { - bbox.min() = this->getMinIndex(); - bbox.max() = this->getMaxIndex(); + (bbox.min)() = this->getMinIndex(); + (bbox.max)() = this->getMaxIndex(); } @@ -2144,19 +2144,19 @@ RootNode::fill(const CoordBBox& bbox, const ValueType& value, bool activ // Iterate over the fill region in axis-aligned, tile-sized chunks. // (The first and last chunks along each axis might be smaller than a tile.) Coord xyz, tileMax; - for (int x = bbox.min().x(); x <= bbox.max().x(); x = tileMax.x() + 1) { + for (int x = (bbox.min)().x(); x <= (bbox.max)().x(); x = tileMax.x() + 1) { xyz.setX(x); - for (int y = bbox.min().y(); y <= bbox.max().y(); y = tileMax.y() + 1) { + for (int y = (bbox.min)().y(); y <= (bbox.max)().y(); y = tileMax.y() + 1) { xyz.setY(y); - for (int z = bbox.min().z(); z <= bbox.max().z(); z = tileMax.z() + 1) { + for (int z = (bbox.min)().z(); z <= (bbox.max)().z(); z = tileMax.z() + 1) { xyz.setZ(z); // Get the bounds of the tile that contains voxel (x, y, z). Coord tileMin = coordToKey(xyz); tileMax = tileMin.offsetBy(ChildT::DIM - 1); - if (xyz != tileMin || Coord::lessThan(bbox.max(), tileMax)) { - // If the box defined by (xyz, bbox.max()) doesn't completely enclose + if (xyz != tileMin || Coord::lessThan((bbox.max)(), tileMax)) { + // If the box defined by (xyz, (bbox.max)()) doesn't completely enclose // the tile to which xyz belongs, create a child node (or retrieve // the existing one). ChildT* child = nullptr; @@ -2177,11 +2177,11 @@ RootNode::fill(const CoordBBox& bbox, const ValueType& value, bool activ } // Forward the fill request to the child. if (child) { - const Coord tmp = Coord::minComponent(bbox.max(), tileMax); + const Coord tmp = Coord::minComponent((bbox.max)(), tileMax); child->fill(CoordBBox(xyz, tmp), value, active); } } else { - // If the box given by (xyz, bbox.max()) completely encloses + // If the box given by (xyz, (bbox.max)()) completely encloses // the tile to which xyz belongs, create the tile (if it // doesn't already exist) and give it the fill value. MapIter iter = this->findOrAddCoord(tileMin); @@ -2210,11 +2210,11 @@ RootNode::denseFill(const CoordBBox& bbox, const ValueType& value, bool // Iterate over the fill region in axis-aligned, tile-sized chunks. // (The first and last chunks along each axis might be smaller than a tile.) Coord xyz, tileMin, tileMax; - for (int x = bbox.min().x(); x <= bbox.max().x(); x = tileMax.x() + 1) { + for (int x = (bbox.min)().x(); x <= (bbox.max)().x(); x = tileMax.x() + 1) { xyz.setX(x); - for (int y = bbox.min().y(); y <= bbox.max().y(); y = tileMax.y() + 1) { + for (int y = (bbox.min)().y(); y <= (bbox.max)().y(); y = tileMax.y() + 1) { xyz.setY(y); - for (int z = bbox.min().z(); z <= bbox.max().z(); z = tileMax.z() + 1) { + for (int z = (bbox.min)().z(); z <= (bbox.max)().z(); z = tileMax.z() + 1) { xyz.setZ(z); // Get the bounds of the tile that contains voxel (x, y, z). @@ -2276,30 +2276,30 @@ RootNode::copyToDense(const CoordBBox& bbox, DenseT& dense) const using DenseValueType = typename DenseT::ValueType; const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride(); - const Coord& min = dense.bbox().min(); + const Coord& min = (dense.bbox().min)(); CoordBBox nodeBBox; - for (Coord xyz = bbox.min(); xyz[0] <= bbox.max()[0]; xyz[0] = nodeBBox.max()[0] + 1) { - for (xyz[1] = bbox.min()[1]; xyz[1] <= bbox.max()[1]; xyz[1] = nodeBBox.max()[1] + 1) { - for (xyz[2] = bbox.min()[2]; xyz[2] <= bbox.max()[2]; xyz[2] = nodeBBox.max()[2] + 1) { + for (Coord xyz = (bbox.min)(); xyz[0] <= (bbox.max)()[0]; xyz[0] = (nodeBBox.max)()[0] + 1) { + for (xyz[1] = (bbox.min)()[1]; xyz[1] <= (bbox.max)()[1]; xyz[1] = (nodeBBox.max)()[1] + 1) { + for (xyz[2] = (bbox.min)()[2]; xyz[2] <= (bbox.max)()[2]; xyz[2] = (nodeBBox.max)()[2] + 1) { // Get the coordinate bbox of the child node that contains voxel xyz. nodeBBox = CoordBBox::createCube(coordToKey(xyz), ChildT::DIM); // Get the coordinate bbox of the interection of inBBox and nodeBBox - CoordBBox sub(xyz, Coord::minComponent(bbox.max(), nodeBBox.max())); + CoordBBox sub(xyz, Coord::minComponent((bbox.max)(), (nodeBBox.max)())); - MapCIter iter = this->findKey(nodeBBox.min()); + MapCIter iter = this->findKey((nodeBBox.min)()); if (iter != mTable.end() && isChild(iter)) {//is a child getChild(iter).copyToDense(sub, dense); } else {//is background or a tile value const ValueType value = iter==mTable.end() ? mBackground : getTile(iter).value; sub.translate(-min); - DenseValueType* a0 = dense.data() + zStride*sub.min()[2]; - for (Int32 x=sub.min()[0], ex=sub.max()[0]+1; x::print(std::ostream& os, int verboseLevel) const if (verboseLevel > 3) { // This forces loading of all non-resident nodes. const math::MinMax extrema = tools::minMax(*this); - minVal = extrema.min(); - maxVal = extrema.max(); + minVal = (extrema.min)(); + maxVal = (extrema.max)(); } const auto nodeCount = this->nodeCount();//fast diff --git a/Sources/OpenVDB/include/openvdb/tree/TreeIterator.h b/Sources/OpenVDB/include/openvdb/tree/TreeIterator.h index 9707c039..653a7dbd 100644 --- a/Sources/OpenVDB/include/openvdb/tree/TreeIterator.h +++ b/Sources/OpenVDB/include/openvdb/tree/TreeIterator.h @@ -795,7 +795,7 @@ inline void TreeValueIteratorBase::setMaxDepth(Index maxDepth) { // level = ROOT_LEVEL - depth - mMinLevel = int(ROOT_LEVEL - std::min(maxDepth, this->getLeafDepth())); + mMinLevel = int(ROOT_LEVEL - (std::min)(maxDepth, this->getLeafDepth())); if (int(mLevel) < mMinLevel) this->next(); } @@ -897,8 +897,8 @@ TreeValueIteratorBase::getBoundingBox(CoordBBox& bbox) const bbox = CoordBBox(); return false; } - bbox.min() = mValueIterList.getCoord(mLevel); - bbox.max() = bbox.min().offsetBy(mValueIterList.getChildDim(mLevel) - 1); + (bbox.min)() = mValueIterList.getCoord(mLevel); + (bbox.max)() = (bbox.min)().offsetBy(mValueIterList.getChildDim(mLevel) - 1); return true; } @@ -1091,7 +1091,7 @@ inline void NodeIteratorBase::setMaxDepth(Index maxDepth) { // level = ROOT_LEVEL - depth - mMinLevel = int(ROOT_LEVEL - std::min(maxDepth, this->getLeafDepth())); + mMinLevel = int(ROOT_LEVEL - (std::min)(maxDepth, this->getLeafDepth())); if (int(mLevel) < mMinLevel) this->next(); } @@ -1135,7 +1135,7 @@ NodeIteratorBase::getCoord() const if (mLevel != ROOT_LEVEL) return mIterList.getCoord(mLevel + 1); RootNodeT* root = nullptr; this->getNode(root); - return root ? root->getMinIndex() : Coord::min(); + return root ? root->getMinIndex() : (Coord::min)(); } @@ -1153,8 +1153,8 @@ NodeIteratorBase::getBoundingBox(CoordBBox& bbox) const root->getIndexRange(bbox); return true; } - bbox.min() = mIterList.getCoord(mLevel + 1); - bbox.max() = bbox.min().offsetBy(mIterList.getChildDim(mLevel + 1) - 1); + (bbox.min)() = mIterList.getCoord(mLevel + 1); + (bbox.max)() = (bbox.min)().offsetBy(mIterList.getChildDim(mLevel + 1) - 1); return true; } diff --git a/Sources/OpenVDB/include/openvdb/tree/ValueAccessor.h b/Sources/OpenVDB/include/openvdb/tree/ValueAccessor.h index 56524b50..9dba5768 100644 --- a/Sources/OpenVDB/include/openvdb/tree/ValueAccessor.h +++ b/Sources/OpenVDB/include/openvdb/tree/ValueAccessor.h @@ -64,7 +64,7 @@ namespace tree { template> + typename IndexSequence = openvdb::make_index_sequence<(std::max)(size_t(1),TreeType::DEPTH)-1>> class ValueAccessorImpl; /// @brief Default alias for a ValueAccessor. This is simply a helper alias @@ -82,7 +82,7 @@ class ValueAccessorImpl; /// no locking takes place. In general it's not advised to mutex lock /// ValueAccessor methods (instead consider creating a accessor per thread). template + size_t CacheLevels =( std::max)(Index(1),TreeType::DEPTH)-1, typename MutexType = void> using ValueAccessor = ValueAccessorImpl>; @@ -117,7 +117,7 @@ using ValueAccessor3 = /// @brief Helper alias for a ValueAccesor which spin locks every API call. template + size_t CacheLevels = (std::max)(Index(1),TreeType::DEPTH)-1> using ValueAccessorRW = ValueAccessorImpl>; @@ -870,7 +870,7 @@ class ValueAccessorImpl final : { static constexpr int64_t Idx = NodeLevelList::template Index; if constexpr (Idx >= 0) { - mKeys[Idx] = Coord::max(); + mKeys[Idx] = (Coord::max)(); mNodes.template get() = nullptr; } } @@ -879,7 +879,7 @@ class ValueAccessorImpl final : /// hash-keys. void clear() override final { - mKeys.fill(Coord::max()); + mKeys.fill((Coord::max)()); mNodes.foreach([](auto& node) { node = nullptr; }); if constexpr (BypassLeafAPI) { LeafCacheT::setBuffer(nullptr); diff --git a/Sources/OpenVDB/include/openvdb/util/MapsUtil.h b/Sources/OpenVDB/include/openvdb/util/MapsUtil.h index 16c2c8e1..be727034 100644 --- a/Sources/OpenVDB/include/openvdb/util/MapsUtil.h +++ b/Sources/OpenVDB/include/openvdb/util/MapsUtil.h @@ -26,12 +26,12 @@ template inline void calculateBounds(const MapType& map, const BBoxd& in, BBoxd& out) { - const Vec3d& min = in.min(); - const Vec3d& max = in.max(); + const Vec3d& min = (in.min)(); + const Vec3d& max = (in.max)(); // the pre-image of the 8 corners of the box Vec3d corners[8]; - corners[0] = in.min();; + corners[0] = (in.min)();; corners[1] = Vec3d(min(0), min(1), min(2)); corners[2] = Vec3d(max(0), max(1), min(2)); corners[3] = Vec3d(min(0), max(1), min(2)); @@ -41,15 +41,15 @@ calculateBounds(const MapType& map, const BBoxd& in, BBoxd& out) corners[7] = Vec3d(min(0), max(1), max(2)); Vec3d pre_image; - Vec3d& out_min = out.min(); - Vec3d& out_max = out.max(); + Vec3d& out_min = (out.min)(); + Vec3d& out_max = (out.max)(); out_min = map.applyInverseMap(corners[0]); out_max = min; for (int i = 1; i < 8; ++i) { pre_image = map.applyInverseMap(corners[i]); for (int j = 0; j < 3; ++j) { - out_min(j) = std::min( out_min(j), pre_image(j)); - out_max(j) = std::max( out_max(j), pre_image(j)); + out_min(j) = (std::min)( out_min(j), pre_image(j)); + out_max(j) = (std::max)( out_max(j), pre_image(j)); } } } @@ -85,8 +85,8 @@ calculateBounds(const MapType& map, const Vec3d& center, const Real radius, BBox coordinate_units.push_back(Vec3d(0,1,0)); coordinate_units.push_back(Vec3d(0,0,1)); - Vec3d& out_min = out.min(); - Vec3d& out_max = out.max(); + Vec3d& out_min = (out.min)(); + Vec3d& out_max = (out.max)(); for (int direction = 0; direction < 3; ++direction) { Vec3d temp = map.applyIJT(coordinate_units[direction]); double offset = @@ -181,8 +181,8 @@ calculateBounds(const math::NonlinearFrustumMap& frus } // for convenience - Vec3d& out_min = out.min(); - Vec3d& out_max = out.max(); + Vec3d& out_min = (out.min)(); + Vec3d& out_max = (out.max)(); Vec3d centerLS = secondMap.applyInverseMap(center); Vec3d voxelSize = secondMap.voxelSize(); @@ -200,13 +200,13 @@ calculateBounds(const math::NonlinearFrustumMap& frus // the bounding box in index space for the points in the frustum const BBoxd& bbox = frustum.getBBox(); // initialize min and max - const double x_min = bbox.min().x(); - const double y_min = bbox.min().y(); - const double z_min = bbox.min().z(); + const double x_min = (bbox.min)().x(); + const double y_min = (bbox.min)().y(); + const double z_min = (bbox.min)().z(); - const double x_max = bbox.max().x(); - const double y_max = bbox.max().y(); - const double z_max = bbox.max().z(); + const double x_max = (bbox.max)().x(); + const double y_max = (bbox.max)().y(); + const double z_max = (bbox.max)().z(); out_min.x() = x_min; out_max.x() = x_max; @@ -227,7 +227,7 @@ calculateBounds(const math::NonlinearFrustumMap& frus extreme2 = secondMap.applyMap(extreme); // convert back to voxel space pre_image = frustum.applyInverseMap(extreme2); - out_max.x() = std::max(x_min, std::min(x_max, pre_image.x())); + out_max.x() = (std::max)(x_min, (std::min)(x_max, pre_image.x())); extreme.x() = xm; extreme.y() = centerLS.y(); @@ -237,7 +237,7 @@ calculateBounds(const math::NonlinearFrustumMap& frus // convert back to voxel space pre_image = frustum.applyInverseMap(extreme2); - out_min.x() = std::max(x_min, std::min(x_max, pre_image.x())); + out_min.x() = (std::max)(x_min, (std::min)(x_max, pre_image.x())); } else if (soln_number == 1) { // the circle was tangent at the focal point @@ -256,7 +256,7 @@ calculateBounds(const math::NonlinearFrustumMap& frus extreme2 = secondMap.applyMap(extreme); // convert back to voxel space pre_image = frustum.applyInverseMap(extreme2); - out_max.y() = std::max(y_min, std::min(y_max, pre_image.y())); + out_max.y() = (std::max)(y_min, (std::min)(y_max, pre_image.y())); extreme.x() = centerLS.x(); extreme.y() = xm; @@ -265,7 +265,7 @@ calculateBounds(const math::NonlinearFrustumMap& frus // convert back to voxel space pre_image = frustum.applyInverseMap(extreme2); - out_min.y() = std::max(y_min, std::min(y_max, pre_image.y())); + out_min.y() = (std::max)(y_min, (std::min)(y_max, pre_image.y())); } else if (soln_number == 1) { // the circle was tangent at the focal point @@ -275,15 +275,15 @@ calculateBounds(const math::NonlinearFrustumMap& frus // the near and far // the closest point. The front of the frustum is at 0 in index space - double near_dist = std::max(centerLS.z() - radiusLS, 0.); + double near_dist = (std::max)(centerLS.z() - radiusLS, 0.); // the farthest point. The back of the frustum is at mDepth in index space - double far_dist = std::min(centerLS.z() + radiusLS, frustum.getDepth() ); + double far_dist = (std::min)(centerLS.z() + radiusLS, frustum.getDepth() ); Vec3d near_point(0.f, 0.f, near_dist); Vec3d far_point(0.f, 0.f, far_dist); - out_min.z() = std::max(z_min, frustum.applyInverseMap(secondMap.applyMap(near_point)).z()); - out_max.z() = std::min(z_max, frustum.applyInverseMap(secondMap.applyMap(far_point)).z()); + out_min.z() = (std::max)(z_min, frustum.applyInverseMap(secondMap.applyMap(near_point)).z()); + out_max.z() = (std::min)(z_max, frustum.applyInverseMap(secondMap.applyMap(far_point)).z()); } diff --git a/Sources/OpenVDB/include/openvdb/util/NodeMasks.h b/Sources/OpenVDB/include/openvdb/util/NodeMasks.h index accffe4f..eb532e46 100644 --- a/Sources/OpenVDB/include/openvdb/util/NodeMasks.h +++ b/Sources/OpenVDB/include/openvdb/util/NodeMasks.h @@ -1249,7 +1249,7 @@ class RootNodeMask RootNodeMask operator!() const { RootNodeMask m = *this; m.toggle(); return m; } const RootNodeMask& operator&=(const RootNodeMask& other) { assert(mIntSize == other.mIntSize); - for (Index32 i = 0, N = std::min(mIntSize, other.mIntSize); i < N; ++i) { + for (Index32 i = 0, N = (std::min)(mIntSize, other.mIntSize); i < N; ++i) { mBits[i] &= other.mBits[i]; } for (Index32 i = other.mIntSize; i < mIntSize; ++i) mBits[i] = 0x00000000; @@ -1257,14 +1257,14 @@ class RootNodeMask } const RootNodeMask& operator|=(const RootNodeMask& other) { assert(mIntSize == other.mIntSize); - for (Index32 i = 0, N = std::min(mIntSize, other.mIntSize); i < N; ++i) { + for (Index32 i = 0, N = (std::min)(mIntSize, other.mIntSize); i < N; ++i) { mBits[i] |= other.mBits[i]; } return *this; } const RootNodeMask& operator^=(const RootNodeMask& other) { assert(mIntSize == other.mIntSize); - for (Index32 i = 0, N = std::min(mIntSize, other.mIntSize); i < N; ++i) { + for (Index32 i = 0, N = (std::min)(mIntSize, other.mIntSize); i < N; ++i) { mBits[i] ^= other.mBits[i]; } return *this; diff --git a/Sources/OpenVDB/include/openvdb/util/PagedArray.h b/Sources/OpenVDB/include/openvdb/util/PagedArray.h index a79f72c7..c7cf5861 100644 --- a/Sources/OpenVDB/include/openvdb/util/PagedArray.h +++ b/Sources/OpenVDB/include/openvdb/util/PagedArray.h @@ -517,7 +517,7 @@ void PagedArray::add_partially_full(Page*& page, size_t si assert(size > 0 && size < Page::Size);//page must be partially full if (size_t m = mSize & Page::Mask) {//page table is also partially full ValueT *s = page->data(), *t = mPageTable.back()->data() + m; - for (size_t i=std::min(mSize+size, mCapacity)-mSize; i; --i) *t++ = *s++; + for (size_t i=(std::min)(mSize+size, mCapacity)-mSize; i; --i) *t++ = *s++; if (mSize+size > mCapacity) {//grow page table mPageTable.push_back( new Page() ); t = mPageTable.back()->data(); diff --git a/Sources/OpenVDB/include/openvdb/util/Util.h b/Sources/OpenVDB/include/openvdb/util/Util.h index 7344269a..d76863db 100644 --- a/Sources/OpenVDB/include/openvdb/util/Util.h +++ b/Sources/OpenVDB/include/openvdb/util/Util.h @@ -16,7 +16,7 @@ OPENVDB_USE_VERSION_NAMESPACE namespace OPENVDB_VERSION_NAME { namespace util { -inline constexpr Index32 INVALID_IDX = std::numeric_limits::max(); +inline constexpr Index32 INVALID_IDX = (std::numeric_limits::max)(); /// @brief coordinate offset table for neighboring voxels inline constexpr Coord COORD_OFFSETS[26] = diff --git a/Sources/OpenVDB/io/Archive.cc b/Sources/OpenVDB/io/Archive.cc index f01caed8..1ad17c17 100644 --- a/Sources/OpenVDB/io/Archive.cc +++ b/Sources/OpenVDB/io/Archive.cc @@ -24,7 +24,7 @@ #pragma clang diagnostic pop #endif #if defined(_WIN32) -#include +#include #include #include #else // !defined(_WIN32) @@ -43,7 +43,7 @@ namespace boost { #if defined(_WIN32) - using namespace std; + using namespace linb; #endif // defined(_WIN32) namespace interprocess diff --git a/Sources/OpenVDB/io/Compression.cc b/Sources/OpenVDB/io/Compression.cc index e7f5e7a6..21b98ba5 100644 --- a/Sources/OpenVDB/io/Compression.cc +++ b/Sources/OpenVDB/io/Compression.cc @@ -101,7 +101,7 @@ zipToStream(std::ostream& os, const char* data, size_t numBytes) } else { // Write the size of the uncompressed data. // numBytes expected to be <= the max value + 1 of a signed int64 - assert(numBytes < size_t(std::numeric_limits::max())); + assert(numBytes < size_t((std::numeric_limits::max)())); Int64 negBytes = -Int64(numBytes); os.write(reinterpret_cast(&negBytes), 8); // Write the uncompressed data. @@ -227,7 +227,7 @@ bloscToStream(std::ostream& os, const char* data, size_t valSize, size_t numVals { const size_t inBytes = valSize * numVals; // inBytes expected to be <= the max value + 1 of a signed int64 - assert(inBytes < size_t(std::numeric_limits::max())); + assert(inBytes < size_t((std::numeric_limits::max)())); int outBytes = int(inBytes) + BLOSC_MAX_OVERHEAD; std::unique_ptr compressedData(new char[outBytes]); diff --git a/Sources/OpenVDB/io/DelayedLoadMetadata.cc b/Sources/OpenVDB/io/DelayedLoadMetadata.cc index 73879683..dbdcf0d6 100644 --- a/Sources/OpenVDB/io/DelayedLoadMetadata.cc +++ b/Sources/OpenVDB/io/DelayedLoadMetadata.cc @@ -186,7 +186,7 @@ void DelayedLoadMetadata::readValue(std::istream& is, Index32 numBytes) is.read(reinterpret_cast(&bytes), sizeof(Index32)); - if (bytes != std::numeric_limits::max()) { + if (bytes != (std::numeric_limits::max)()) { if (bytes > Index32(0)) { std::unique_ptr compressedBuffer(new char[bytes]); is.read(reinterpret_cast(compressedBuffer.get()), bytes); @@ -231,8 +231,8 @@ void DelayedLoadMetadata::readValue(std::istream& is, Index32 numBytes) void DelayedLoadMetadata::writeValue(std::ostream& os) const { // metadata has a limit of 2^32 bytes - assert(mMask.size() < std::numeric_limits::max()); - assert(mCompressedSize.size() < std::numeric_limits::max()); + assert(mMask.size() < (std::numeric_limits::max)()); + assert(mCompressedSize.size() < (std::numeric_limits::max)()); if (mMask.empty() && mCompressedSize.empty()) return; @@ -242,7 +242,7 @@ void DelayedLoadMetadata::writeValue(std::ostream& os) const os.write(reinterpret_cast(&count), sizeof(Index32)); const Index32 zeroSize(0); - const Index32 maxSize(std::numeric_limits::max()); + const Index32 maxSize((std::numeric_limits::max)()); { // mask buffer size_t compressedBytes(0); @@ -254,7 +254,7 @@ void DelayedLoadMetadata::writeValue(std::ostream& os) const } if (compressedBuffer) { - assert(compressedBytes < std::numeric_limits::max()); + assert(compressedBytes < (std::numeric_limits::max)()); Index32 bytes(static_cast(compressedBytes)); os.write(reinterpret_cast(&bytes), sizeof(Index32)); os.write(reinterpret_cast(compressedBuffer.get()), compressedBytes); @@ -281,7 +281,7 @@ void DelayedLoadMetadata::writeValue(std::ostream& os) const } if (compressedBuffer) { - assert(compressedBytes < std::numeric_limits::max()); + assert(compressedBytes < (std::numeric_limits::max)()); Index32 bytes(static_cast(compressedBytes)); os.write(reinterpret_cast(&bytes), sizeof(Index32)); os.write(reinterpret_cast(compressedBuffer.get()), compressedBytes); diff --git a/Sources/OpenVDB/io/File.cc b/Sources/OpenVDB/io/File.cc index cecee6d3..898079ac 100644 --- a/Sources/OpenVDB/io/File.cc +++ b/Sources/OpenVDB/io/File.cc @@ -224,7 +224,7 @@ File::getSize() const /// but as of 9/2014, Houdini ships without the Boost.Filesystem library, /// which makes it much less convenient to use that library. - Index64 result = std::numeric_limits::max(); + Index64 result = (std::numeric_limits::max)(); std::string mesg = "could not get size of file " + filename(); diff --git a/Sources/OpenVDB/math/Transform.cc b/Sources/OpenVDB/math/Transform.cc index e137bef8..b78f6d38 100644 --- a/Sources/OpenVDB/math/Transform.cc +++ b/Sources/OpenVDB/math/Transform.cc @@ -96,7 +96,7 @@ Transform::read(std::istream& is) internal::LegacyFrustum legacyFrustum(is); CoordBBox bb = legacyFrustum.getBBox(); - BBoxd bbox(bb.min().asVec3d(), bb.max().asVec3d() + BBoxd bbox((bb.min)().asVec3d(), (bb.max)().asVec3d() /* -Vec3d(1,1,1) */ ); double taper = legacyFrustum.getTaper(); @@ -330,14 +330,14 @@ Transform::postMult(const Mat3d& m) BBoxd Transform::indexToWorld(const CoordBBox& indexBBox) const { - return this->indexToWorld(BBoxd(indexBBox.min().asVec3d(), indexBBox.max().asVec3d())); + return this->indexToWorld(BBoxd((indexBBox.min)().asVec3d(), (indexBBox.max)().asVec3d())); } BBoxd Transform::indexToWorld(const BBoxd& indexBBox) const { - const Vec3d &imin = indexBBox.min(), &imax = indexBBox.max(); + const Vec3d &imin = (indexBBox.min)(), &imax = (indexBBox.max)(); Vec3d corners[8]; corners[0] = imin; @@ -350,7 +350,7 @@ Transform::indexToWorld(const BBoxd& indexBBox) const corners[7] = Vec3d(imin(0), imax(1), imax(2)); BBoxd worldBBox; - Vec3d &wmin = worldBBox.min(), &wmax = worldBBox.max(); + Vec3d &wmin = (worldBBox.min)(), &wmax = (worldBBox.max)(); wmin = wmax = this->indexToWorld(corners[0]); for (int i = 1; i < 8; ++i) { @@ -366,7 +366,7 @@ BBoxd Transform::worldToIndex(const BBoxd& worldBBox) const { Vec3d indexMin, indexMax; - calculateBounds(*this, worldBBox.min(), worldBBox.max(), indexMin, indexMax); + calculateBounds(*this, (worldBBox.min)(), (worldBBox.max)(), indexMin, indexMax); return BBoxd(indexMin, indexMax); } @@ -375,7 +375,7 @@ CoordBBox Transform::worldToIndexCellCentered(const BBoxd& worldBBox) const { Vec3d indexMin, indexMax; - calculateBounds(*this, worldBBox.min(), worldBBox.max(), indexMin, indexMax); + calculateBounds(*this, (worldBBox.min)(), (worldBBox.max)(), indexMin, indexMax); return CoordBBox(Coord::round(indexMin), Coord::round(indexMax)); } @@ -384,7 +384,7 @@ CoordBBox Transform::worldToIndexNodeCentered(const BBoxd& worldBBox) const { Vec3d indexMin, indexMax; - calculateBounds(*this, worldBBox.min(), worldBBox.max(), indexMin, indexMax); + calculateBounds(*this, (worldBBox.min)(), (worldBBox.max)(), indexMin, indexMax); return CoordBBox(Coord::floor(indexMin), Coord::floor(indexMax)); } @@ -417,8 +417,8 @@ calculateBounds(const Transform& t, for (int i = 1; i < 8; ++i) { pre_image = t.worldToIndex(corners[i]); for (int j = 0; j < 3; ++j) { - minIS(j) = std::min(minIS(j), pre_image(j)); - maxIS(j) = std::max(maxIS(j), pre_image(j)); + minIS(j) = (std::min)(minIS(j), pre_image(j)); + maxIS(j) = (std::max)(maxIS(j), pre_image(j)); } } } @@ -494,10 +494,10 @@ Transform::print(std::ostream& os, const std::string& indent) const size_t w = 0; for (int row = 0; row < 4; ++row) { std::string str = Local::rowAsString(linear[row]); - w = std::max(w, str.size()); + w = (std::max)(w, str.size()); linearRow.push_back(str); } - w = std::max(w, 30); + w = (std::max)(w, 30); const int iw = int(w); // Print rows of the linear component matrix side-by-side with frustum parameters. @@ -517,9 +517,9 @@ Transform::print(std::ostream& os, const std::string& indent) const } else { // If the frustum bounding box doesn't fit on one line, split it into two lines. ostr << indent << " " << std::left << std::setw(iw) << linearRow[2] - << " bounds: " << frustum.getBBox().min() << " ->\n"; + << " bounds: " << (frustum.getBBox().min)() << " ->\n"; ostr << indent << " " << std::left << std::setw(iw) << linearRow[3] - << " " << frustum.getBBox().max() << "\n"; + << " " << (frustum.getBBox().max)() << "\n"; } } else { diff --git a/Sources/OpenVDB/points/AttributeSet.cc b/Sources/OpenVDB/points/AttributeSet.cc index 1d17df8c..dcec6e5e 100644 --- a/Sources/OpenVDB/points/AttributeSet.cc +++ b/Sources/OpenVDB/points/AttributeSet.cc @@ -1189,7 +1189,7 @@ AttributeSet::Descriptor::unusedGroupOffset(size_t hint) const // all group offsets are in use if (unusedGroups() == size_t(0)) { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } // build a list of group indices @@ -1204,7 +1204,7 @@ AttributeSet::Descriptor::unusedGroupOffset(size_t hint) const // return hint if not already in use - if (hint != std::numeric_limits::max() && + if (hint != (std::numeric_limits::max)() && hint < availableGroups() && std::find(indices.begin(), indices.end(), hint) == indices.end()) { return hint; diff --git a/Sources/OpenVDB/points/StreamCompression.cc b/Sources/OpenVDB/points/StreamCompression.cc index 9efedc8e..e7406331 100644 --- a/Sources/OpenVDB/points/StreamCompression.cc +++ b/Sources/OpenVDB/points/StreamCompression.cc @@ -580,7 +580,7 @@ PagedOutputStream::compressAndWrite(const char* buffer, size_t size) { if (size == 0) return; - assert(size < std::numeric_limits::max()); + assert(size < (std::numeric_limits::max)()); this->resize(size); diff --git a/Sources/Ptex/include/Ptex.h b/Sources/Ptex/include/Ptex.h index fe0482f2..8bd4ea19 100644 --- a/Sources/Ptex/include/Ptex.h +++ b/Sources/Ptex/include/Ptex.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include diff --git a/Sources/PyBind11/include/pybind11/detail/common.h b/Sources/PyBind11/include/pybind11/detail/common.h index 31a54c77..91652479 100644 --- a/Sources/PyBind11/include/pybind11/detail/common.h +++ b/Sources/PyBind11/include/pybind11/detail/common.h @@ -312,11 +312,15 @@ PYBIND11_WARNING_POP #include #include #include -#if defined(__has_include) -# if __has_include() -# include -# endif -#endif +#if defined(_WIN32) +# include +#else // !defined(_WIN32) +# if defined(__has_include) +# if __has_include() +# include +# endif // __has_include() +# endif // defined(__has_include) +#endif // defined(_WIN32) // Must be after including or one of the other headers specified by the standard #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L diff --git a/Sources/TBBMalloc/backend.cpp b/Sources/TBBMalloc/backend.cpp index c240e030..c65bb7e6 100644 --- a/Sources/TBBMalloc/backend.cpp +++ b/Sources/TBBMalloc/backend.cpp @@ -16,7 +16,7 @@ #include /* for memset */ #include -#include "tbbmalloc_internal.h" +#include "TBBMalloc/tbbmalloc_internal.h" namespace rml { namespace internal { diff --git a/Sources/TBBMalloc/backref.cpp b/Sources/TBBMalloc/backref.cpp index b0ea8306..b26d3b7f 100644 --- a/Sources/TBBMalloc/backref.cpp +++ b/Sources/TBBMalloc/backref.cpp @@ -14,7 +14,7 @@ limitations under the License. */ -#include "tbbmalloc_internal.h" +#include "TBBMalloc/tbbmalloc_internal.h" #include /* for placement new */ namespace rml { diff --git a/Sources/TBBMalloc/frontend.cpp b/Sources/TBBMalloc/frontend.cpp index 727d8855..08132dfe 100644 --- a/Sources/TBBMalloc/frontend.cpp +++ b/Sources/TBBMalloc/frontend.cpp @@ -14,7 +14,7 @@ limitations under the License. */ -#include "tbbmalloc_internal.h" +#include "TBBMalloc/tbbmalloc_internal.h" #include #include /* for placement new */ #include /* for memset */ diff --git a/Sources/TBBMalloc/Customize.h b/Sources/TBBMalloc/include/TBBMalloc/Customize.h similarity index 98% rename from Sources/TBBMalloc/Customize.h rename to Sources/TBBMalloc/include/TBBMalloc/Customize.h index 4fc867c3..d8b23c47 100644 --- a/Sources/TBBMalloc/Customize.h +++ b/Sources/TBBMalloc/include/TBBMalloc/Customize.h @@ -28,7 +28,7 @@ #include "OneTBB/oneapi/tbb/detail/_utils.h" #include "OneTBB/oneapi/tbb/detail/_assert.h" -#include "Synchronize.h" +#include "TBBMallocProxy/Synchronize.h" #if __TBB_USE_ITT_NOTIFY #include "../tbb/itt_notify.h" @@ -70,7 +70,7 @@ inline void do_yield() { #define USE_DEFAULT_MEMORY_MAPPING 1 // To support malloc replacement -#include "proxy.h" +#include "TBBMallocProxy/proxy.h" #if MALLOC_UNIXLIKE_OVERLOAD_ENABLED #define malloc_proxy __TBB_malloc_proxy diff --git a/Sources/TBBMalloc/MapMemory.h b/Sources/TBBMalloc/include/TBBMalloc/MapMemory.h similarity index 100% rename from Sources/TBBMalloc/MapMemory.h rename to Sources/TBBMalloc/include/TBBMalloc/MapMemory.h diff --git a/Sources/TBBMalloc/Statistics.h b/Sources/TBBMalloc/include/TBBMalloc/Statistics.h similarity index 100% rename from Sources/TBBMalloc/Statistics.h rename to Sources/TBBMalloc/include/TBBMalloc/Statistics.h diff --git a/Sources/TBBMalloc/include/TBBMalloc/TBBMalloc.h b/Sources/TBBMalloc/include/TBBMalloc/TBBMalloc.h new file mode 100644 index 00000000..a6309e67 --- /dev/null +++ b/Sources/TBBMalloc/include/TBBMalloc/TBBMalloc.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/Sources/TBBMalloc/TypeDefinitions.h b/Sources/TBBMalloc/include/TBBMalloc/TypeDefinitions.h similarity index 100% rename from Sources/TBBMalloc/TypeDefinitions.h rename to Sources/TBBMalloc/include/TBBMalloc/TypeDefinitions.h diff --git a/Sources/TBBMalloc/backend.h b/Sources/TBBMalloc/include/TBBMalloc/backend.h similarity index 99% rename from Sources/TBBMalloc/backend.h rename to Sources/TBBMalloc/include/TBBMalloc/backend.h index 1880ab46..4e4cde3a 100644 --- a/Sources/TBBMalloc/backend.h +++ b/Sources/TBBMalloc/include/TBBMalloc/backend.h @@ -15,7 +15,7 @@ */ #ifndef __TBB_tbbmalloc_internal_H - #error tbbmalloc_internal.h must be included at this point + #error TBBMalloc.h must be included at this point #endif #ifndef __TBB_backend_H diff --git a/Sources/TBBMalloc/large_objects.h b/Sources/TBBMalloc/include/TBBMalloc/large_objects.h similarity index 99% rename from Sources/TBBMalloc/large_objects.h rename to Sources/TBBMalloc/include/TBBMalloc/large_objects.h index ff205ccd..5a5e2595 100644 --- a/Sources/TBBMalloc/large_objects.h +++ b/Sources/TBBMalloc/include/TBBMalloc/large_objects.h @@ -15,7 +15,7 @@ */ #ifndef __TBB_tbbmalloc_internal_H - #error tbbmalloc_internal.h must be included at this point + #error TBBMalloc.h must be included at this point #endif #ifndef __TBB_large_objects_H diff --git a/Sources/TBBMalloc/shared_utils.h b/Sources/TBBMalloc/include/TBBMalloc/shared_utils.h similarity index 100% rename from Sources/TBBMalloc/shared_utils.h rename to Sources/TBBMalloc/include/TBBMalloc/shared_utils.h diff --git a/Sources/TBBMalloc/tbbmalloc_internal.h b/Sources/TBBMalloc/include/TBBMalloc/tbbmalloc_internal.h similarity index 99% rename from Sources/TBBMalloc/tbbmalloc_internal.h rename to Sources/TBBMalloc/include/TBBMalloc/tbbmalloc_internal.h index 62cfea08..31e094f7 100644 --- a/Sources/TBBMalloc/tbbmalloc_internal.h +++ b/Sources/TBBMalloc/include/TBBMalloc/tbbmalloc_internal.h @@ -51,7 +51,7 @@ #include /* for placement new */ #endif #include "OneTBB/oneapi/tbb/scalable_allocator.h" -#include "tbbmalloc_internal_api.h" +#include "TBBMalloc/tbbmalloc_internal_api.h" /********* Various compile-time options **************/ diff --git a/Sources/TBBMalloc/tbbmalloc_internal_api.h b/Sources/TBBMalloc/include/TBBMalloc/tbbmalloc_internal_api.h similarity index 100% rename from Sources/TBBMalloc/tbbmalloc_internal_api.h rename to Sources/TBBMalloc/include/TBBMalloc/tbbmalloc_internal_api.h diff --git a/Sources/TBBMalloc/large_objects.cpp b/Sources/TBBMalloc/large_objects.cpp index 28473247..fb550f03 100644 --- a/Sources/TBBMalloc/large_objects.cpp +++ b/Sources/TBBMalloc/large_objects.cpp @@ -14,7 +14,7 @@ limitations under the License. */ -#include "tbbmalloc_internal.h" +#include "TBBMalloc/tbbmalloc_internal.h" #include "../tbb/environment.h" #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) diff --git a/Sources/TBBMalloc/tbbmalloc.cpp b/Sources/TBBMalloc/tbbmalloc.cpp index 80a216a0..bbc3224e 100644 --- a/Sources/TBBMalloc/tbbmalloc.cpp +++ b/Sources/TBBMalloc/tbbmalloc.cpp @@ -15,7 +15,7 @@ */ #include "TypeDefinitions.h" // Customize.h and proxy.h get included -#include "tbbmalloc_internal_api.h" +#include "TBBMalloc/tbbmalloc_internal_api.h" #include "../tbb/assert_impl.h" // Out-of-line TBB assertion handling routines are instantiated here. #include "OneTBB/oneapi/tbb/version.h" diff --git a/Sources/TBBMallocProxy/function_replacement.cpp b/Sources/TBBMallocProxy/function_replacement.cpp index 92de4c21..45723ae2 100644 --- a/Sources/TBBMallocProxy/function_replacement.cpp +++ b/Sources/TBBMallocProxy/function_replacement.cpp @@ -38,7 +38,7 @@ #include #include -#include "function_replacement.h" +#include "TBBMallocProxy/function_replacement.h" // The information about a standard memory allocation function for the replacement log struct FunctionInfo { diff --git a/Sources/TBBMalloc/Synchronize.h b/Sources/TBBMallocProxy/include/TBBMallocProxy/Synchronize.h similarity index 100% rename from Sources/TBBMalloc/Synchronize.h rename to Sources/TBBMallocProxy/include/TBBMallocProxy/Synchronize.h diff --git a/Sources/TBBMallocProxy/include/TBBMallocProxy/TBBMallocProxy.h b/Sources/TBBMallocProxy/include/TBBMallocProxy/TBBMallocProxy.h new file mode 100644 index 00000000..fbadf4a5 --- /dev/null +++ b/Sources/TBBMallocProxy/include/TBBMallocProxy/TBBMallocProxy.h @@ -0,0 +1,5 @@ +#pragma once + +#include +#include +#include diff --git a/Sources/TBBMallocProxy/function_replacement.h b/Sources/TBBMallocProxy/include/TBBMallocProxy/function_replacement.h similarity index 100% rename from Sources/TBBMallocProxy/function_replacement.h rename to Sources/TBBMallocProxy/include/TBBMallocProxy/function_replacement.h diff --git a/Sources/TBBMallocProxy/proxy.h b/Sources/TBBMallocProxy/include/TBBMallocProxy/proxy.h similarity index 100% rename from Sources/TBBMallocProxy/proxy.h rename to Sources/TBBMallocProxy/include/TBBMallocProxy/proxy.h diff --git a/Sources/TBBMallocProxy/proxy_overload_osx.h b/Sources/TBBMallocProxy/include/TBBMallocProxy/proxy_overload_osx.h similarity index 100% rename from Sources/TBBMallocProxy/proxy_overload_osx.h rename to Sources/TBBMallocProxy/include/TBBMallocProxy/proxy_overload_osx.h diff --git a/Sources/TBBMallocProxy/proxy.cpp b/Sources/TBBMallocProxy/proxy.cpp index caf1d863..4626f267 100644 --- a/Sources/TBBMallocProxy/proxy.cpp +++ b/Sources/TBBMallocProxy/proxy.cpp @@ -38,7 +38,7 @@ #include #endif // __unix__ && !__ANDROID__ -#include "proxy.h" +#include "TBBMallocProxy/proxy.h" #include "OneTBB/oneapi/tbb/detail/_config.h" #include "OneTBB/oneapi/tbb/scalable_allocator.h" @@ -59,7 +59,7 @@ #include // Synchronization primitives to protect original library pointers and new_handler -#include "../TBBMalloc/Synchronize.h" +#include "TBBMallocProxy/Synchronize.h" // Use MallocMutex implementation typedef MallocMutex ProxyMutex; @@ -139,7 +139,7 @@ static void *orig_msize; #elif MALLOC_ZONE_OVERLOAD_ENABLED -#include "proxy_overload_osx.h" +#include "TBBMallocProxy/proxy_overload_osx.h" #endif // MALLOC_ZONE_OVERLOAD_ENABLED @@ -347,7 +347,7 @@ void operator delete[](void* ptr, const std::nothrow_t&) noexcept { #include -#include "function_replacement.h" +#include "TBBMallocProxy/function_replacement.h" template // generic function to find length of array inline size_t arrayLength(const T(&)[N]) {