[#bsl-bitset-set-04]
= xref:bsl.adoc[bsl]::xref:bsl/bitset.adoc[bitset]::set
:relfileprefix: ../../
:mrdocs:

Set the bit at the specified `pos` to 1, or to `val` if supplied&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;bitset&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/bitset.adoc[bitset&lt;N&gt;]&
set(
    std::size&lowbar;t pos,
    int val = true);
----

== Description

Set the bit at the specified `pos` of this bitset to 1 and return a reference to this modifiable bitset&period; Optionally specify `val` as the value to set the bit&period; If `val` is non&hyphen;zero, the bit is set to 1, otherwise the bit is set to 0&period;

== Return Value

reference to this modifiable bitset

== Parameters

[cols="1,4"]
|===
| Name| Description
| *pos*
| index of the bit to set
| *val*
| value to assign to the bit (default true)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
