forked from kscience/kmath
optimize attributes plus
This commit is contained in:
parent
2d309e050b
commit
6e24b563b2
@ -140,4 +140,8 @@ public fun <A : Attribute<Unit>> Attributes(
|
||||
attribute: A,
|
||||
): Attributes = MapAttributes(mapOf(attribute to Unit))
|
||||
|
||||
public operator fun Attributes.plus(other: Attributes): Attributes = MapAttributes(content + other.content)
|
||||
public operator fun Attributes.plus(other: Attributes): Attributes = when{
|
||||
isEmpty() -> other
|
||||
other.isEmpty() -> this
|
||||
else -> MapAttributes(content + other.content)
|
||||
}
|
Loading…
Reference in New Issue
Block a user