a placeholder to match the Rep tparam for duration type, the semantics of this template parameter are documented in std::chrono::duration<> (in brief, the underlying arithmetic type used to store the number of ticks), for our purposes it is simply a formal parameter.
typename Period
a placeholder to match the Period tparam for duration type, the semantics of this template parameter are documented in std::chrono::duration<> (in brief, the length of the tick in seconds, expressed as a std::ratio<>), for our purposes it is simply a formal parameter.
Returns
Type
Description
GcRule
static Intersection(GcRuleTypes &&...)
Return a GcRule that deletes cells if all the rules passed in would delete the cells.
Parameters
Name
Description
gc_rules
GcRuleTypes &&...
the set of GC rules.
typename...
Returns
Type
Description
GcRule
static Union(GcRuleTypes &&...)
Return a GcRule that deletes cells if any the rules passed in would delete the cells.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis page details the \u003ccode\u003eGcRule\u003c/code\u003e class in the Google Cloud Bigtable C++ client library, with version 2.37.0-rc as the latest available version.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGcRule\u003c/code\u003e class provides a convenient way to create garbage collection rules for Bigtable, implementing a thin wrapper around \u003ccode\u003egoogle::bigtable::admin::v2::GcRule\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class supports constructors and operators for managing \u003ccode\u003eGcRule\u003c/code\u003e objects, including copy and move operations, as well as assignment operators.\u003c/p\u003e\n"],["\u003cp\u003eKey functions within \u003ccode\u003eGcRule\u003c/code\u003e include static methods like \u003ccode\u003eMaxNumVersions\u003c/code\u003e, \u003ccode\u003eMaxAge\u003c/code\u003e, \u003ccode\u003eIntersection\u003c/code\u003e, and \u003ccode\u003eUnion\u003c/code\u003e to define different types of garbage collection rules, along with methods to convert them to proto form like \u003ccode\u003eas_proto()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGcRule\u003c/code\u003e provides convenient ways to manage the number of versions of a cell, or the age of a cell to determine when to do garbage collection.\u003c/p\u003e\n"]]],[],null,["# Class GcRule (2.42.0-rc)\n\nVersion latestkeyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/bigtable/latest/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.41.0](/cpp/docs/reference/bigtable/2.41.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.40.0](/cpp/docs/reference/bigtable/2.40.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.39.0](/cpp/docs/reference/bigtable/2.39.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.38.0](/cpp/docs/reference/bigtable/2.38.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.37.0](/cpp/docs/reference/bigtable/2.37.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.36.0](/cpp/docs/reference/bigtable/2.36.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.35.0](/cpp/docs/reference/bigtable/2.35.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.34.0](/cpp/docs/reference/bigtable/2.34.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.33.0](/cpp/docs/reference/bigtable/2.33.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.32.0](/cpp/docs/reference/bigtable/2.32.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.31.0](/cpp/docs/reference/bigtable/2.31.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.30.0](/cpp/docs/reference/bigtable/2.30.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.29.0](/cpp/docs/reference/bigtable/2.29.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.28.0](/cpp/docs/reference/bigtable/2.28.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.27.0](/cpp/docs/reference/bigtable/2.27.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.26.0](/cpp/docs/reference/bigtable/2.26.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.25.1](/cpp/docs/reference/bigtable/2.25.1/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.24.0](/cpp/docs/reference/bigtable/2.24.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.23.0](/cpp/docs/reference/bigtable/2.23.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.22.1](/cpp/docs/reference/bigtable/2.22.1/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.21.0](/cpp/docs/reference/bigtable/2.21.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.20.0](/cpp/docs/reference/bigtable/2.20.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.19.0](/cpp/docs/reference/bigtable/2.19.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.18.0](/cpp/docs/reference/bigtable/2.18.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.17.0](/cpp/docs/reference/bigtable/2.17.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.16.0](/cpp/docs/reference/bigtable/2.16.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.15.1](/cpp/docs/reference/bigtable/2.15.1/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.14.0](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.13.0](/cpp/docs/reference/bigtable/2.13.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.12.0](/cpp/docs/reference/bigtable/2.12.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule)\n- [2.11.0](/cpp/docs/reference/bigtable/2.11.0/classgoogle_1_1cloud_1_1bigtable_1_1GcRule) \nImplement a thin wrapper around google::bigtable::admin::v2::GcRule. \nProvides functions to create GcRules in a convenient form.\n\nConstructors\n------------\n\n### GcRule(GcRule \\&\\&)\n\nUse default constructors and assignments.\n\n### GcRule(GcRule const \\&)\n\nUse default constructors and assignments.\n\nOperators\n---------\n\n### operator=(GcRule \\&\\&)\n\nUse default constructors and assignments.\n\n### operator=(GcRule const \\&)\n\nUse default constructors and assignments.\n\nFunctions\n---------\n\n### static MaxNumVersions(std::int32_t)\n\nCreate a garbage collection rule that keeps the last `n` versions.\n\n### static MaxAge(std::chrono::duration\\\u003c Rep, Period \\\u003e)\n\nReturn a garbage collection rule that deletes cells in a column older than the given duration. \nThe function accepts any instantiation of `std::chrono::duration\u003c\u003e` for the `duration` parameter. For example: \n\n auto rule1 = bigtable::GcRule::MaxAge(std::chrono::hours(48));\n auto rule2 = bigtable::GcRule::MaxAge(std::chrono::seconds(48 * 3600));\n\n###### See Also\n\n[`std::chrono::duration\u003c\u003e`](http://en.cppreference.com/w/cpp/chrono/duration) for more details.\n\n### static Intersection(GcRuleTypes \\&\\&...)\n\nReturn a [GcRule](/cpp/docs/reference/bigtable/latest/classgoogle_1_1cloud_1_1bigtable_1_1GcRule) that deletes cells if all the rules passed in would delete the cells.\n\n### static Union(GcRuleTypes \\&\\&...)\n\nReturn a [GcRule](/cpp/docs/reference/bigtable/latest/classgoogle_1_1cloud_1_1bigtable_1_1GcRule) that deletes cells if any the rules passed in would delete the cells.\n\n### as_proto() const \\&\n\nConvert to the proto form.\n\n### as_proto() \\&\\&\n\nMove the internal proto out."]]