Skip to content

Idea: use constexpr for int version functions #3222

@ankane

Description

@ankane

What language and solver does this apply to? C++

Describe the problem you are trying to solve.

Hi, I'd like to check the OR-Tools version during compilation to make sure it's compatible with the C++ code that uses it.

Describe the solution you'd like

Use constexpr for int version functions

constexpr int OrToolsMajorVersion();

constexpr int OrToolsMinorVersion();

constexpr int OrToolsPatchVersion();

so users can do

static_assert(
  operations_research::OrToolsMajorVersion() == 9 &&
  operations_research::OrToolsMinorVersion() == 3,
  "Incompatible OR-Tools version"
);

Describe alternatives you've considered

Another option would be to export the OR_TOOLS_MAJOR, OR_TOOLS_MINOR, and OR_TOOLS_PATCH constants.

Metadata

Metadata

Assignees

Labels

Feature RequestMissing Feature/WrapperLang: C++Native implementation issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions