---
title: "NSMapInsertKnownAbsent(_:_:_:)"
framework: foundation
role: symbol
role_heading: Function
path: "foundation/nsmapinsertknownabsent(_:_:_:)"
---

# NSMapInsertKnownAbsent(_:_:_:)

Inserts a key-value pair into the specified table if the pair had not been previously added.

## Declaration

```swift
func NSMapInsertKnownAbsent(_ table: NSMapTable<AnyObject, AnyObject>, _ key: UnsafeRawPointer?, _ value: UnsafeRawPointer?)
```

## Discussion

Discussion Inserts key (which must not be notAKeyMarker) and value into table. Unlike NSMapInsert, this function raises NSInvalidArgumentException if table already includes a key that matches key. key is compared with notAKeyMarker using pointer comparison; if key is identical to notAKeyMarker, raises NSInvalidArgumentException.

## See Also

### Related Documentation

- [NSMapInsertIfAbsent(_:_:_:)](foundation/nsmapinsertifabsent(_:_:_:).md)
- [NSMapRemove(_:_:)](foundation/nsmapremove(_:_:).md)
- [NSMapInsert(_:_:_:)](foundation/nsmapinsert(_:_:_:).md)

### Functions

- [NSAllMapTableKeys(_:)](foundation/nsallmaptablekeys(_:).md)
- [NSAllMapTableValues(_:)](foundation/nsallmaptablevalues(_:).md)
- [NSCompareMapTables(_:_:)](foundation/nscomparemaptables(_:_:).md)
- [NSCopyMapTableWithZone(_:_:)](foundation/nscopymaptablewithzone(_:_:).md)
- [NSCountMapTable(_:)](foundation/nscountmaptable(_:).md)
- [NSCreateMapTable(_:_:_:)](foundation/nscreatemaptable(_:_:_:).md)
- [NSCreateMapTableWithZone(_:_:_:_:)](foundation/nscreatemaptablewithzone(_:_:_:_:).md)
- [NSEndMapTableEnumeration(_:)](foundation/nsendmaptableenumeration(_:).md)
- [NSEnumerateMapTable(_:)](foundation/nsenumeratemaptable(_:).md)
- [NSFreeMapTable(_:)](foundation/nsfreemaptable(_:).md)
- [NSMapGet(_:_:)](foundation/nsmapget(_:_:).md)
- [NSMapInsert(_:_:_:)](foundation/nsmapinsert(_:_:_:).md)
- [NSMapInsertIfAbsent(_:_:_:)](foundation/nsmapinsertifabsent(_:_:_:).md)
- [NSMapMember(_:_:_:_:)](foundation/nsmapmember(_:_:_:_:).md)
- [NSMapRemove(_:_:)](foundation/nsmapremove(_:_:).md)
