compare

Navigation:  NxLib API > C++ Interface > NxLibItem >

compare

Previous pageReturn to chapter overviewNext page

Compare the item's value to a constant. All operators are templates and will be generated by the compiler for the C++ types int, double, bool, std::string and char*.

Signatures

Variants throwing exceptions on API errors:

template <typename T> int compare(T const& value) const

Variants returning API errors as int* parameter:

template <typename T> int compare(int* returnCode, T const& value) const

template<int CharCount> int compare(int* returnCode, char const (&value)[CharCount]) const

Parameters

returnCode

The error code returned when accessing the item

value

The value to compare the item's value with

Return Value

-1

This item's value is smaller that the constant it was compared with.

0

The values are equal.

1

This item's value is larger than the constant it was compared with.