CLion 2016.2 Help

Generating Operators

Basics

For the class fields, you can generate equality, relational and stream output operators using the Generate feature.

Generating operators

To generate an operator, do the following:
  1. Place caret at the desired place.
  2. To invoke the Generate pop-up window, do one of the following:
    • On the main menu, choose Code | Generate or press Alt+Insert.
    • Right click on the editor and select Generate from the context menu.
  3. In the Generate pop-up, select the desired option:
    cl_GeneratePopup
  4. In the Select Fields dialog that appears:
    • Select one or more fields to be included into operator being generated. For multiple selection use Ctrl and Shift keys.
    • Select the desired check boxes according to your preferences. For more information, refer to Select Fields dialog help page.
      cl_SelectFieldsDialog
  5. Click OK to proceed.
    Note, that If some of the operators you're going to generate are already defined, you'll be offered with an option to replace them, or to add missing operators to existing ones.
Last modified: 22 November 2016