Re: Function completion for GVariant maybe types?



On Thu, Feb 21, 2013 at 1:02 AM, Markus Elfring <Markus Elfring web de> wrote:
> In glibmm 2.36 it will be possible to test whether the GVariant is null or not
> by just doing if (v), see bug 690121.

Thanks for your information about the issue "Provide operator BoolExpr for
VariantBase".

How do deal with the desire to reset an object to "nothing" by the means of this
C++ class library?

Regards,
Markus

#include <glibmm.h>
#include <iostream>

void print_v(const Glib::Variant<int> &v)
{
if (v.gobj() == NULL)
std::cout << "v is a nothing" << std::endl;
else
std::cout << "v is an int containing " << v.get() << std::endl;
}

int main() {
Glib::Variant<int> v = Glib::Variant<int>::create(4);
print_v(v);

// Now I want to set v to 'Nothing'
v = Glib::Variant<int>();
print_v(v);
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]