From 525fef708d9db5f6d0778f869405695243f87edf Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 12 Mar 2019 01:53:42 -0700 Subject: [PATCH] Prevent VS2017 from emitting ambiguous symbol errors (second time) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17863 Differential Revision: D14404818 Pulled By: soumith fbshipit-source-id: 9dac6b926e270e2a29ec2e4dba2e93984da0e5f5 --- torch/csrc/api/include/torch/ordered_dict.h | 20 ++++++++++---------- torch/csrc/jit/custom_operator.h | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/torch/csrc/api/include/torch/ordered_dict.h b/torch/csrc/api/include/torch/ordered_dict.h index 05bea8a..74d08d2 100644 --- a/torch/csrc/api/include/torch/ordered_dict.h +++ b/torch/csrc/api/include/torch/ordered_dict.h @@ -159,25 +159,25 @@ class OrderedDict { /// Returns a newly allocated vector and copies all keys from this /// `OrderedDict` into the vector. - std::vector keys() const; + ::std::vector keys() const; /// Returns a newly allocated vector and copies all values from this /// `OrderedDict` into the vector. - std::vector values() const; + ::std::vector values() const; /// Returns a newly allocated vector and copies all keys and values from this /// `OrderedDict` into a vector of `std::pair`. - std::vector> pairs() const; + ::std::vector> pairs() const; private: /// A mapping from a key to an index into the `items_` vector. - std::unordered_map index_; + ::std::unordered_map index_; /// The items stored in the `OrderedDict`. - std::vector items_; + ::std::vector items_; /// A description of the keys stored in the `OrderedDict`. - std::string key_description_{"Key"}; + ::std::string key_description_{"Key"}; }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OrderedDict::Item ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -231,7 +231,7 @@ class OrderedDict::Item { private: /// This is stored as an std::pair because it will make Python binding a lot, /// lot easier. - std::pair pair_; + ::std::pair pair_; }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OrderedDict ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -438,7 +438,7 @@ const std::vector::Item>& OrderedDict< } template -std::vector OrderedDict::keys() const { +::std::vector OrderedDict::keys() const { std::vector keys; keys.reserve(size()); for (const auto& item : items_) { @@ -448,7 +448,7 @@ std::vector OrderedDict::keys() const { } template -std::vector OrderedDict::values() const { +::std::vector OrderedDict::values() const { std::vector values; values.reserve(size()); for (const auto& item : items_) { @@ -458,7 +458,7 @@ std::vector OrderedDict::values() const { } template -std::vector> OrderedDict::pairs() const { +::std::vector> OrderedDict::pairs() const { std::vector> values; values.reserve(size()); for (const auto& item : items_) { diff --git a/torch/csrc/jit/custom_operator.h b/torch/csrc/jit/custom_operator.h index e787dc8..b7958b3 100644 --- a/torch/csrc/jit/custom_operator.h +++ b/torch/csrc/jit/custom_operator.h @@ -36,28 +36,28 @@ void checkStaticTypes() { } template -std::vector createArgumentVectorFromTypes(Indices indices) { +::std::vector createArgumentVectorFromTypes(Indices indices) { checkStaticTypes...>(); // Arguments are named "_" return {Argument("_" + std::to_string(Is), getTypePtr>())...}; } template -std::vector createReturns(Indices indices) { +::std::vector createReturns(Indices indices) { return createArgumentVectorFromTypes(); } /// Unpack a tuple return type into a vector of return types, one per tuple /// element. template -std::vector createReturns(std::tuple* tuple) { +::std::vector createReturns(std::tuple* tuple) { // Create an index pack so we can call `get` on the tuple next. return createReturns(typename MakeIndices::indices{}); } /// Create a single-element `vector` for simple (non-tuple) return types. template -std::vector createReturns(ReturnType*) { +::std::vector createReturns(ReturnType*) { checkStaticTypes>(); return {Argument("_1", getTypePtr>())}; } @@ -65,7 +65,7 @@ std::vector createReturns(ReturnType*) { /// Creates a vector of `Argument` from `FunctionTraits` and a pack of indices /// into the argument list. template -std::vector createArgumentVectorFromTraits(Indices indices) { +::std::vector createArgumentVectorFromTraits(Indices indices) { using ArgumentTypes = typename FunctionTraits::parameter_types; return createArgumentVectorFromTypes< c10::guts::typelist::element_t...>(indices); -- 2.7.4