---
title: llarp::OwnedBuffer

---

# llarp::OwnedBuffer





## Public Functions

|                | Name           |
| -------------- | -------------- |
| template <typename T ,typename  =std::enable_if_t<sizeof(T) == 1>\> <br>| **[OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md#function-ownedbuffer)**(std::unique_ptr< T[]> buf, size_t sz) |
| | **[OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md#function-ownedbuffer)**(size_t sz) |
| | **[OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md#function-ownedbuffer)**(const byte_t * ptr, size_t sz) |
| | **[OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md#function-ownedbuffer)**(const [OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) & ) =delete |
| [OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) & | **[operator=](Classes/structllarp_1_1OwnedBuffer.md#function-operator=)**(const [OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) & ) =delete |
| | **[OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md#function-ownedbuffer)**([OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) && ) =default |
| [OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) & | **[operator=](Classes/structllarp_1_1OwnedBuffer.md#function-operator=)**([OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) && ) =delete |
| | **[operator llarp_buffer_t](Classes/structllarp_1_1OwnedBuffer.md#function-operator-llarp-buffer-t)**() |
| std::vector< byte_t > | **[copy](Classes/structllarp_1_1OwnedBuffer.md#function-copy)**() const<br>copy everything in this owned buffer into a vector  |
| [OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) | **[copy_from](Classes/structllarp_1_1OwnedBuffer.md#function-copy-from)**(const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & b) |
| [OwnedBuffer](Classes/structllarp_1_1OwnedBuffer.md) | **[copy_used](Classes/structllarp_1_1OwnedBuffer.md#function-copy-used)**(const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & b) |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| std::unique_ptr< byte_t[]> | **[buf](Classes/structllarp_1_1OwnedBuffer.md#variable-buf)**  |
| size_t | **[sz](Classes/structllarp_1_1OwnedBuffer.md#variable-sz)**  |

## Public Functions Documentation

### function OwnedBuffer

```cpp
template <typename T ,
typename  =std::enable_if_t<sizeof(T) == 1>>
inline OwnedBuffer(
    std::unique_ptr< T[]> buf,
    size_t sz
)
```


### function OwnedBuffer

```cpp
inline explicit OwnedBuffer(
    size_t sz
)
```


### function OwnedBuffer

```cpp
inline explicit OwnedBuffer(
    const byte_t * ptr,
    size_t sz
)
```


### function OwnedBuffer

```cpp
OwnedBuffer(
    const OwnedBuffer & 
) =delete
```


### function operator=

```cpp
OwnedBuffer & operator=(
    const OwnedBuffer & 
) =delete
```


### function OwnedBuffer

```cpp
OwnedBuffer(
    OwnedBuffer && 
) =default
```


### function operator=

```cpp
OwnedBuffer & operator=(
    OwnedBuffer && 
) =delete
```


### function operator llarp_buffer_t

```cpp
inline operator llarp_buffer_t()
```


### function copy

```cpp
std::vector< byte_t > copy() const
```

copy everything in this owned buffer into a vector 

### function copy_from

```cpp
static OwnedBuffer copy_from(
    const llarp_buffer_t & b
)
```


### function copy_used

```cpp
static OwnedBuffer copy_used(
    const llarp_buffer_t & b
)
```


## Public Attributes Documentation

### variable buf

```cpp
std::unique_ptr< byte_t[]> buf;
```


### variable sz

```cpp
size_t sz;
```


-------------------------------

Updated on 2023-01-09 at 19:27:44 +0000