Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.2

# StrBuf::operator =( const StrRef & )

Assign a `StrBuf` from a `StrRef`.

Virtual? | No |
Class | `StrBuf` |
Arguments | `const StrRef &s` | (implied) reference of the `StrRef` instance
Returns | `void` |

## Notes

Initialize the `StrBuf` and `StrRef` before assignment.

Any memory allocated for the `StrBuf`'s `buffer` is separate from that of the `StrRef`'s `buffer`.

## Example

Copy

    #include &lt;iostream&gt;

    #include &lt;stdhdrs.h&gt;
    #include &lt;strbuf.h&gt;

    int main( int argc, char **argv )
    {
        StrRef sr( "xyz" );
        StrBuf sb;

        sb = sr;   // assign StrBuf from StrRef

        cout &lt;&lt; "sr.Text() returns \"" &lt;&lt; sr.Text() &lt;&lt; "\"\n";
        cout &lt;&lt; "sb.Text() returns \"" &lt;&lt; sb.Text() &lt;&lt; "\"\n";
    }

Executing the preceding code produces the following output:

    sr.Text() returns "xyz"
    sb.Text() returns "xyz"

Your search for returned results