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

C/C++ API Documentation | 2026.1

# StrBuf::operator =( const StrBuf & )

Assign a `StrBuf` from another `StrBuf`.

Virtual? | No |
Class | `StrBuf` |
Arguments | `const StrBuf &buf` | (implied) reference of the `StrBuf` from which assignment occurs
Returns | `void` |

## Notes

Initialize both `StrBuf`s before the assignment.

Any memory allocated for the assigned `StrBuf`'s `buffer` is separate from the memory for the `StrBuf`'s `buffer` from which assignment occurs.

Do not assign a `StrBuf` to itself.

## Example

Copy

    #include &lt;iostream&gt;

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

    int main( int argc, char **argv )
    {
        StrBuf sba;
        StrBuf sbb;

        sba.Set( "xyz" );

        sbb = sba;   // assign StrBuf to StrBuf

        cout &lt;&lt; "sba.Text() returns \"" &lt;&lt; sba.Text() &lt;&lt; "\"\n";
        cout &lt;&lt; "sbb.Text() returns \"" &lt;&lt; sbb.Text() &lt;&lt; "\"\n";
    }

Executing the preceding code produces the following output:

    sba.Text() returns "xyz"
    sbb.Text() returns "xyz"

Your search for returned results