Skip to content

Commit 52161f6

Browse files
committed
math_opt: Fix MSVC compile of attr_key.h
1 parent 0200771 commit 52161f6

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

ortools/math_opt/elemental/attr_key.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,20 @@ class AttrKey {
9999
}
100100

101101
// Element iteration.
102-
constexpr const value_type* begin() const { return element_ids_.begin(); }
103-
constexpr const value_type* end() const { return element_ids_.end(); }
102+
constexpr const value_type* begin() const {
103+
#if defined(_MSC_VER)
104+
return &(*element_ids_.begin());
105+
#else
106+
return element_ids_.begin();
107+
#endif
108+
}
109+
constexpr const value_type* end() const {
110+
#if defined(_MSC_VER)
111+
return &(*element_ids_.end());
112+
#else
113+
return element_ids_.end();
114+
#endif
115+
}
104116

105117
// `AttrKey` is comparable (ordering is lexicographic) and hashable.
106118
//

0 commit comments

Comments
 (0)