Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class SavedLiteral
Note: This documentation is automatically generated.
When storing a reference to a literal, it is important not to forget when
reading it back to take its representative. Otherwise, we might introduce
literal that have already been removed, which will break invariants in a
bunch of places.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSavedLiteral\u003c/code\u003e class helps manage references to literals, ensuring data integrity during retrieval.\u003c/p\u003e\n"],["\u003cp\u003eWhen using a \u003ccode\u003eSavedLiteral\u003c/code\u003e, it's crucial to access its representative value using the \u003ccode\u003eGet\u003c/code\u003e method to avoid using removed literals.\u003c/p\u003e\n"],["\u003cp\u003eThis approach prevents breaking invariants within the system by maintaining consistency between stored and accessed literals.\u003c/p\u003e\n"]]],["The `SavedLiteral` class in C++ manages references to literals, ensuring consistency. Key actions include storing a literal's reference and retrieving its representative when reading it back. The documentation highlights the critical need to retrieve the representative, otherwise introducing removed literals can break invariants. The class provides methods: `Get` to retrieve the representative, and `SavedLiteral` constructors, one default and one that takes an integer `ref` argument.\n"],null,["# SavedLiteral\n\nC++ Reference: class SavedLiteral\n=================================\n\n\nNote: This documentation is automatically generated.\nWhen storing a reference to a literal, it is important not to forget when reading it back to take its representative. Otherwise, we might introduce literal that have already been removed, which will break invariants in a bunch of places.\n\n| Method ||\n|---------------------------------------------------------------------------------------------------|------------------------------------------------------------------|\n| [`Get`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/presolve_context.h#L60) | Return type: `int ` Arguments: `PresolveContext* context` \u003cbr /\u003e |\n| [`SavedLiteral`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/presolve_context.h#L58) | \u003cbr /\u003e |\n| [`SavedLiteral`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/presolve_context.h#L59) | Return type: `explicit ` Arguments: `int ref` \u003cbr /\u003e |"]]