2.11 The class PlAtom - Supporting Prolog constants (version 2)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • A C++ interface to SWI-Prolog
        • A C++ interface to SWI-Prolog (Version 2)
          • The class PlAtom - Supporting Prolog constants (version 2)
            • Direct comparision to char *
            • Direct comparision to PlAtom
            • Extraction of the atom and comparison to PlAtom
            • Extraction of the atom and comparison to char *

2.11.3 Extraction of the atom and comparison to PlAtom

Example:

static PlAtom ATOM_read("read");

PREDICATE(test, 1)
{ PlAtom a1(A1);

  if ( a1 == ATOM_read )
    ...;
}

This approach is basically the same as section 2.11.2, but in nested if-then-else the extraction of the atom from the term is done only once.