Jack,
You can use pointer semantics [1] to differ nulls from zeroes. It won't
work for primitive types (as int), but it is a rare case, really, that your
value is a primitive type. And even if you want to use value, that only
contains single int it is simple enough to make a class-wrapper.
Here's how you use it:
IgniteClient client = IgniteClient::Start(cfg);
cache::CacheClient<KeyType, ValueType*> cache =
client.GetCache<KeyType, ValueType*>("cacheName");
ValueType* val = cache.Get(key);
if (val == nullptr)
{
...
}
// Do not forget to release memory.
delete val;
Also, you can use smart pointers to avoid manual memory management.
Also, it is possible specialize BinaryType<T> for any wrapper class or class
template, for example boost::optional or similar.
[1] -
https://apacheignite-cpp.readme.io/docs/serialization#section-reading-and-writing-values
Best Regards,
Igor
On Mon, Mar 18, 2019 at 11:32 PM jackluo923 <[email protected]>
wrote:
> Hi Igor,
> I took a look at the master branch. I have couple questions.
>
> 1. For void getAndPutIfAbsent, the method has this comment:
> @param valOut Previously contained value regardless of whether put happened
> or not (null if there
> * was no previous value).
>
> How do we differentiate if the two cases where we returned previous value
> of
> "0"(previous value is 0) vs a "null" (no previous value)? Is this a planned
> limitation of c++ thin-client?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>