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

C/C++ API Documentation | 2025.1

# StrRef::operator =( StrPtr & )

Set a `StrPtr` to reference an existing `StrPtr` or null-terminated string.

Virtual? | No |
Class | `StrRef` |
Arguments | `StrPtr &s` | the `StrPtr` to reference
Returns | `void` |

## Notes

The `=` operator is equivalent to calling `Set()`.

## Example

Copy

    #include &lt;iostream&gt;

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

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

        str1.Set( "xyz" );
        StrRef sr = str1;

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

Executing the preceding code produces the following output:

    str1 = "xyz"
    sr.Text() returns "xyz"

Your search for returned results