File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 17
17
#include < cstdint>
18
18
#include < functional>
19
19
#include < limits>
20
+ #include < memory>
20
21
#include < string>
21
22
#include < tuple>
22
23
#include < utility>
30
31
#include " absl/strings/match.h"
31
32
#include " absl/strings/str_cat.h"
32
33
#include " absl/types/span.h"
34
+ #include " google/protobuf/arena.h"
33
35
#include " google/protobuf/text_format.h"
34
36
#include " ortools/base/iterator_adaptors.h"
35
37
#include " ortools/flatzinc/checker.h"
@@ -64,6 +66,10 @@ int FalseLiteral(int var) { return -var - 1; }
64
66
65
67
// Helper class to convert a flatzinc model to a CpModelProto.
66
68
struct CpModelProtoWithMapping {
69
+ CpModelProtoWithMapping ()
70
+ : arena(std::make_unique<google::protobuf::Arena>()),
71
+ proto (*google::protobuf::Arena::Create<CpModelProto>(arena.get())) {}
72
+
67
73
// Returns a constant CpModelProto variable created on-demand.
68
74
int LookupConstant (int64_t value);
69
75
@@ -135,7 +141,8 @@ struct CpModelProtoWithMapping {
135
141
SolverLogger* logger);
136
142
137
143
// The output proto.
138
- CpModelProto proto;
144
+ std::unique_ptr<google::protobuf::Arena> arena;
145
+ CpModelProto& proto;
139
146
SatParameters parameters;
140
147
141
148
// Mapping from flatzinc variables to CpModelProto variables.
You can’t perform that action at this time.
0 commit comments