Exemplo n.º 1
0
//Primitive assignment
//FIXME: Make this less copypaste!
value& value::operator=(int8_t val)
{
    if(!tag_)
        set(tag_byte(val));
    else switch(tag_->get_type())
    {
    case tag_type::Byte:
        static_cast<tag_byte&>(*tag_).set(val);
        break;
    case tag_type::Short:
        static_cast<tag_short&>(*tag_).set(val);
        break;
    case tag_type::Int:
        static_cast<tag_int&>(*tag_).set(val);
        break;
    case tag_type::Long:
        static_cast<tag_long&>(*tag_).set(val);
        break;
    case tag_type::Float:
        static_cast<tag_float&>(*tag_).set(val);
        break;
    case tag_type::Double:
        static_cast<tag_double&>(*tag_).set(val);
        break;

    default:
        throw std::bad_cast();
    }
    return *this;
}
value_initializer::value_initializer(int8_t val)            : value(tag_byte(val)) {}
Exemplo n.º 3
0
tag_value& tag_value::operator=(std::int8_t x) {
  *this = tag_byte(x);
  return *this;
}