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

C/C++ API Documentation | 2026.1

# MapApi::Insert( const StrPtr &, const StrPtr &, MapType )

Adds a new entry to the mapping.

Virtual? | No |
Class | `MapApi` |
Arguments | `StrPtr & l` | the left side of the entry
| `StrPtr & r` | the right side of the entry
| `MapType t` | the mapping type (by default, `MapInclude`)
Returns | `void` |

## Notes

`Insert()` adds one new entry to a mapping at the "bottom" (highest precedence) position in the map. The `MapType` parameter indicates whether the entry is a standard inclusion (the default), an exclusion, or an overlay mapping (only useful when modeling a client view).

## Example

The following example demonstrates the construction and use of a branch view mapping.

    MapApi branch;
    branch.Insert( StrRef( "//depot/main/..." ), StrRef( "//depot/rel1/..." ) );

    StrBuf source( "//depot/main/file.c" );
    StrBuf target;

    branch.Translate( source, target );
    printf( "%s -> %s\n", source.Text(), target.Text() );

This produces the following output:

    //depot/main/file.c -> //depot/rel1/file.c

Your search for returned results