Skip to content

AstAttributeMechanism::operator[]

Get an attribute value.

Synopsis

Declared in <src/midend/astProcessing/AstAttributeMechanism.h>

AstAttribute*
operator[](std::string const& name) const;

Description

Returns the value associated with the given attribute, or null if the attribute does not exist. This method does not copy the attribute before returning it, therefore the caller should not delete the attribute. Erasing the attribute from the container may cause the pointer to become invalid, depending on the attribute's ownership policy. If the attribute uses the AstAttribute::CONTAINER_OWNERSHIP method then the attribute can be modified through its pointer without affecting attributes in other containers, otherwise the behavior is up to the attribute's designer.

The caller will need to dynamic_cast the returned pointer to the appropriate subclass of AstAttribute.

Return Value

an attribute value.

Parameters

Name Description
name The right operand

Created with MrDocs