CXXR (C++ R) API
Public Member Functions | Friends
CXXR::NodeStack::ElementProxy Class Reference

Proxy object for an element of a NodeStack. More...

#include <NodeStack.hpp>

List of all members.

Public Member Functions

ElementProxyoperator= (const ElementProxy &rhs)
ElementProxyoperator= (RObject *node)
 Redirect encapsulated pointer.
 operator RObject *const () const

Friends

class NodeStack

Detailed Description

Proxy object for an element of a NodeStack.

Objects of this class are used to allow the elements of an NodeStack to be examined and modified using the same syntax as would be used for accessing an array of RObject*, whilst nevertheless enforcing the logic for protection against garbage collection. See Item 30 of Scott Meyers's 'More Effective C++' for a general discussion of proxy objects, but see the errata. (It may look complicated, but an optimising compiler should be able to distil an invocation of NodeStack::operator[] into very few instructions.)


Member Function Documentation

CXXR::NodeStack::ElementProxy::operator RObject *const ( ) const
inline
Returns:
The pointer encapsulated by the proxied element.
ElementProxy& CXXR::NodeStack::ElementProxy::operator= ( const ElementProxy rhs)
inline

Copy the value of the proxied element from another proxied element.

Parameters:
rhsProxied element whose value is to be copied.
Returns:
Reference to this ElementProxy.
ElementProxy& CXXR::NodeStack::ElementProxy::operator= ( RObject node)
inline

Redirect encapsulated pointer.

Parameters:
nodeNew pointer value.
Returns:
Reference to this ElementProxy.

The documentation for this class was generated from the following file: