scoped_ptr -> unique_ptr

This commit is contained in:
lperron@google.com
2013-12-12 14:43:57 +00:00
parent 981f0be4dd
commit fa476a4d86
4 changed files with 8 additions and 5 deletions

View File

@@ -11,6 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "base/unique_ptr.h"
#include "base/commandlineflags.h"
#include "base/commandlineflags.h"
#include "base/integral_types.h"
@@ -203,7 +205,7 @@ void DeclareConstraint(int index,
void ExportToGraphFile(const CPModelProto& proto,
File* const file,
GraphExporter::GraphFormat format) {
scoped_ptr<GraphExporter> exporter(
std::unique_ptr<GraphExporter> exporter(
GraphExporter::MakeFileExporter(file, format));
exporter->WriteHeader(proto.model());
for (int i = 0; i < proto.expressions_size(); ++i) {
@@ -274,7 +276,6 @@ void ExportToGraphFile(const CPModelProto& proto,
int Run() {
// ----- Load input file into protobuf -----
File::Init();
File* const file = File::Open(FLAGS_input, "r");
if (file == NULL) {
LOG(WARNING) << "Cannot open " << FLAGS_input;

View File

@@ -77,7 +77,7 @@ class NQueenSymmetry : public SymmetryBreaker {
private:
Solver* const solver_;
const std::vector<IntVar*> vars_;
std::map<IntVar*, int> indices_;
std::map<const IntVar*, int> indices_;
const int size_;
};

View File

@@ -21,6 +21,7 @@
#include <algorithm>
#include <cstdio>
#include <cstring>
#include "base/unique_ptr.h"
#include <string>
#include "base/callback.h"
@@ -89,7 +90,7 @@ template <typename GraphType> class DimacsAssignmentParser {
const char* reason;
NodeIndex num_left_nodes;
ArcIndex num_arcs;
scoped_ptr<string> bad_line;
std::unique_ptr<string> bad_line;
};
ErrorTrackingState state_;
@@ -288,7 +289,7 @@ LinearSumAssignment<GraphType>* DimacsAssignmentParser<GraphType>::Parse(
*error_message = "empty graph description";
return NULL;
}
scoped_ptr<PermutationCycleHandler<ArcIndex> > cycle_handler(
std::unique_ptr<PermutationCycleHandler<ArcIndex> > cycle_handler(
assignment_->ArcAnnotationCycleHandler());
GraphType* graph = graph_builder_->Graph(cycle_handler.get());
if (graph == NULL) {

View File

@@ -54,6 +54,7 @@
#include <stdio.h>
#include <string.h> // strlen
#include <map>
#include "base/unique_ptr.h"
#include <string>
#include <utility>
#include <vector>