Add [C++ 筆記] Lambda
This commit is contained in:
237
content/posts/2019/[C++ 筆記] Lambda/index.md
Normal file
237
content/posts/2019/[C++ 筆記] Lambda/index.md
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
---
|
||||||
|
slug: "[C++ 筆記] Lambda"
|
||||||
|
title: "[C++ 筆記] Lambda"
|
||||||
|
description:
|
||||||
|
toc: true
|
||||||
|
authors:
|
||||||
|
- awin
|
||||||
|
tags:
|
||||||
|
- c++
|
||||||
|
categories:
|
||||||
|
- Programming
|
||||||
|
series:
|
||||||
|
- C++ 筆記
|
||||||
|
date: 2019-12-15T00:00:00
|
||||||
|
lastmod: 2019-12-15T00:00:00
|
||||||
|
featuredVideo:
|
||||||
|
featuredImage:
|
||||||
|
draft: false
|
||||||
|
enableComment: true
|
||||||
|
---
|
||||||
|
|
||||||
|
一個簡單的 Lamdba 運算式:
|
||||||
|
```cpp
|
||||||
|
[] (int x, int y) -> bool {
|
||||||
|
return x < y;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!--more-->
|
||||||
|
|
||||||
|
- 以中括號開頭,中括號被稱為*lamdba 導入器(lamdba introducer)*
|
||||||
|
- 小括號裡面是*lamdba 參數列表(lambda parameter list)*
|
||||||
|
- 如果沒有參數,小括號可以省略,`[] () {...}` 可以簡寫成 `[] {...}`
|
||||||
|
- 箭號(`->`)後面是回傳的型別,如果沒寫就由 `return` 自動推斷
|
||||||
|
|
||||||
|
將 Lamdba 運算式指定給變數:
|
||||||
|
```cpp
|
||||||
|
auto comapre = [] (int x, int y) -> bool {
|
||||||
|
return x < y;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Lamdba的擷取子句
|
||||||
|
以中括號開頭的 *lamdba 導入器* 可以將外部的變數傳給 Lamdba 運算式,正式名稱是「擷取子句(capture clause)」。
|
||||||
|
`[=]` 表示它們會以值擷取(captured by value)。Scope內的變數可以在 lamdba 內使用,但是不可以改變。
|
||||||
|
`[&]` 表示它們會以參考擷取(captured by reference)。Scope內的變數可以在 lamdba 內使用,可以改變。
|
||||||
|
|
||||||
|
## 以值擷取(captured by value)
|
||||||
|
假設有一段程式如下:
|
||||||
|
```cpp
|
||||||
|
void testLambda() {
|
||||||
|
float notUsed = 1.0f;
|
||||||
|
std::vector<int32_t> numlist{10, 20, 30, 50, 60};
|
||||||
|
auto findInRange = [=](int32_t start, int32_t end) {
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::cout << "Result: " << findInRange(25, 35) << "\n";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
用`[=]`可以用來擷取 lamdba scope 範圍所及的變數,沒有在 Lamdba 運算式裡面被用到的變數就不會被擷取,例如 `float notUsed = 1.0f;`。
|
||||||
|
另一個重點是:**被擷取的變數是不可以更改的**。例如,不能在 lambda 裡面這樣寫:
|
||||||
|
```cpp
|
||||||
|
auto findInRange = [=](int32_t start, int32_t end) {
|
||||||
|
numlist.push_back(5); // ERROR!
|
||||||
|
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
如果一定要在 lambda 內改變擷取的變數,那必須指名 lambda 為 `mutable`:
|
||||||
|
```cpp
|
||||||
|
auto findInRange = [=](int32_t start, int32_t end) mutable { // <-- assign mutable
|
||||||
|
numlist.push_back(5);
|
||||||
|
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
根據書上解釋 ,可以裡解為 compiler 會將 lamdba 編為一個 class,像是:
|
||||||
|
```cpp
|
||||||
|
class __Lambda8C1A5 {
|
||||||
|
public:
|
||||||
|
__Lambda8C1A5(const std::vector<int32_t>& arg1) : numlist(arg1) {}
|
||||||
|
auto operator()(int32_t start, int32_t end) const { // const!
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<int32_t> numlist;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
這也解釋了 lamdba 的擷取範圍與原理。而 `mutable` 則是讓 `operator()` 不為 `const`,如下:
|
||||||
|
```cpp
|
||||||
|
auto findInRange = [=](int32_t start, int32_t end) mutable { // <-- assign mutable
|
||||||
|
numlist.push_back(5);
|
||||||
|
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
class __Lambda8C1A5 {
|
||||||
|
public:
|
||||||
|
__Lambda8C1A5(const std::vector<int32_t>& arg1) : numlist(arg1) {}
|
||||||
|
auto operator()(int32_t start, int32_t end) { // No const here
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<int32_t> numlist;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## 以值擷取特定的變數
|
||||||
|
若只需要擷取特定的變數,那就直接在 lamdba 導入器(就是`[]`)寫入變數名稱,例如:
|
||||||
|
```cpp
|
||||||
|
int var1 = 10;
|
||||||
|
int var2 = 20;
|
||||||
|
int var3 = 30;
|
||||||
|
|
||||||
|
auto afunc = [var1, var2] () {
|
||||||
|
...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 以參考擷取(captured by reference)
|
||||||
|
`[&]` 會擷取 scope 內的所有外部變數,而且可以修改:
|
||||||
|
```cpp
|
||||||
|
void testLambda() {
|
||||||
|
float notUsed = 1.0f;
|
||||||
|
std::vector<int32_t> numlist{ 10, 20, 30, 50, 60 };
|
||||||
|
auto findInRange = [&](int32_t start, int32_t end) { // Use & here
|
||||||
|
numlist.push_back(100); // OK
|
||||||
|
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::cout << "Result: " << findInRange(25, 35) << "\n";
|
||||||
|
std::cout << "numlist: ";
|
||||||
|
for (auto n : numlist) {
|
||||||
|
std::cout << n << " ";
|
||||||
|
}
|
||||||
|
std::cout << "\n"; // Output numlist: 10 20 30 50 60 100
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 以參考擷取特定的變數
|
||||||
|
但是直接參考全部的外部變數不是好的作法,這讓你有機會做出一些意外的修改,所以請擷取有需要的變數就好:
|
||||||
|
```cpp
|
||||||
|
void testLambda() {
|
||||||
|
float notUsed = 1.0f;
|
||||||
|
std::vector<int32_t> numlist{ 10, 20, 30, 50, 60 };
|
||||||
|
|
||||||
|
auto findInRange = [&numlist](int32_t start, int32_t end) {
|
||||||
|
numlist.push_back(100); // OK
|
||||||
|
|
||||||
|
for (auto num : numlist) {
|
||||||
|
if (num >= start && num <= end) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
如果有多個變數需要擷取,那就用 `,` 分開:
|
||||||
|
```cpp
|
||||||
|
auto findInRange = [&numlist, &var1, &var2](int32_t start, int32_t end) {
|
||||||
|
...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## 混合擷取
|
||||||
|
以值擷取跟參考擷取也可以寫在一起:
|
||||||
|
```cpp
|
||||||
|
auto findInRange = [=, &numlist](int32_t start, int32_t end) {
|
||||||
|
...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
上面的例子中,`numlist` 會是參考擷取,其他的外部變數則是以值擷取。
|
||||||
|
|
||||||
|
或是:
|
||||||
|
```cpp
|
||||||
|
auto findInRange = [&, numlist](int32_t start, int32_t end) {
|
||||||
|
...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
上面的例子中,`numlist` 會以值擷取,其他的外部變數則是參考擷取。
|
||||||
|
|
||||||
|
但是,如果已經使用了 `=` ,就不可以再以值擷取其他變數,像是 `[=, numlist]` 就是不合法的。
|
||||||
|
反之,如果已經使用了 `&`,就不可以再參考擷取其他變數,像是 `[&, &var1]` 就是不合法的。
|
||||||
|
|
||||||
|
## 存取 class
|
||||||
|
Lamdba 寫在 class 裡面的時候,不論[「以值擷取 」](#以值擷取captured-by-value)或是[「以參考擷取」](#以參考擷取captured-by-reference)都沒辦法傳遞成員變數(member variable),只能傳遞 `this`,透過 `this` 來存取成員變數。例:
|
||||||
|
```cpp
|
||||||
|
class BigBuffer {
|
||||||
|
public:
|
||||||
|
void modify(int x, int y, ...) {
|
||||||
|
auto modifyBuffer = [this] () { // Use this
|
||||||
|
if (buffer) { // equal to this->buffer
|
||||||
|
// do something with buffer
|
||||||
|
}
|
||||||
|
};
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t bufferSize = 0;
|
||||||
|
std::unique_ptr<uint8_t[]> buffer = nullptr;
|
||||||
|
};
|
||||||
|
```
|
||||||
234
content/posts/2019/[C++ 筆記] rvalue reference/index.md
Normal file
234
content/posts/2019/[C++ 筆記] rvalue reference/index.md
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
---
|
||||||
|
slug: "[C++ 筆記] rvalue reference"
|
||||||
|
title: "[C++ 筆記] rvalue reference"
|
||||||
|
description:
|
||||||
|
toc: true
|
||||||
|
authors:
|
||||||
|
- awin
|
||||||
|
tags:
|
||||||
|
- c++
|
||||||
|
categories:
|
||||||
|
- Programming
|
||||||
|
series:
|
||||||
|
- C++ 筆記
|
||||||
|
date: 2019-12-08T00:00:00
|
||||||
|
lastmod: 2019-12-08T00:00:00
|
||||||
|
featuredVideo:
|
||||||
|
featuredImage:
|
||||||
|
draft: false
|
||||||
|
enableComment: true
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
rvalue 是指:
|
||||||
|
- 等號右邊的值
|
||||||
|
- 臨時的值,例如運算的結果
|
||||||
|
- 無法被取址(address-of)的物件
|
||||||
|
|
||||||
|
<!--more-->
|
||||||
|
|
||||||
|
## rvalue reference
|
||||||
|
一般的參考只能參考[[lvalue]],如下的程式是ok的:
|
||||||
|
```cpp
|
||||||
|
int a = 10;
|
||||||
|
int& b = a;
|
||||||
|
```
|
||||||
|
|
||||||
|
但是像這樣就不行了:
|
||||||
|
```cpp
|
||||||
|
int a = 10;
|
||||||
|
int b = 5;
|
||||||
|
int& c = a + b;
|
||||||
|
```
|
||||||
|
|
||||||
|
因為`a+b`是一個 rvalue(臨時的值,沒辦法取址),所以無法參考。
|
||||||
|
但是可以用`&&`來參考 rvalue。例如:
|
||||||
|
```cpp
|
||||||
|
int a = 10;
|
||||||
|
int b = 5;
|
||||||
|
int&& c = a + b; // c = 15
|
||||||
|
```
|
||||||
|
|
||||||
|
而不用這樣:
|
||||||
|
```cpp
|
||||||
|
int a = 10;
|
||||||
|
int b = 5;
|
||||||
|
int r = a + b;
|
||||||
|
int& c = r;
|
||||||
|
```
|
||||||
|
|
||||||
|
了解 rvalue reference 之後,就可以實作類別的 move constructor 跟 move assignment operator。這可以減少複製的成本。
|
||||||
|
|
||||||
|
## Move constructor
|
||||||
|
假設我們有一個 class 叫 BigBuffer,定義如下:
|
||||||
|
```cpp
|
||||||
|
class BigBuffer {
|
||||||
|
public:
|
||||||
|
BigBuffer(int size=100*1024*1024) :
|
||||||
|
bufferSize(size)
|
||||||
|
{
|
||||||
|
std::cout << "BigBuffer constructor\n";
|
||||||
|
this->buffer = std::make_unique<uint8_t[]>(bufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
~BigBuffer() {
|
||||||
|
std::cout << "BigBuffer destructor\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
BigBuffer(const BigBuffer& src) {
|
||||||
|
std::cout << "BigBuffer copy constructor\n";
|
||||||
|
bufferSize = src.bufferSize;
|
||||||
|
buffer = std::make_unique<uint8_t[]>(bufferSize);
|
||||||
|
std::memcpy(buffer.get(), src.buffer.get(), bufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigBuffer& operator= (BigBuffer& src) {
|
||||||
|
std::cout << "BigBuffer copy operator\n";
|
||||||
|
bufferSize = src.bufferSize;
|
||||||
|
buffer = std::make_unique<uint8_t[]>(bufferSize);
|
||||||
|
std::memcpy(buffer.get(), src.buffer.get(), bufferSize);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int bufferSize = 0;
|
||||||
|
std::unique_ptr<uint8_t[]> buffer = nullptr;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
這個 class 的特色就是每一次使用都會佔用100MB的記憶體空間,想像下面的程式的動作:
|
||||||
|
```cpp
|
||||||
|
BigBuffer buf1;
|
||||||
|
// Do something with buf1
|
||||||
|
// Assign to buf2
|
||||||
|
BigBuffer buf2 = buf1;
|
||||||
|
```
|
||||||
|
|
||||||
|
執行訊息:
|
||||||
|
```
|
||||||
|
BigBuffer constructor // create buf1
|
||||||
|
BigBuffer copy constructor, copy 104857600Bytes // copy buf1 to buf2
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
這會先產生 `buf1`,然後把 `buf1` copy 給 `buf2`。如果我們想要省下 copy 的成本,這時候 Move constructor 就可以派上用場了。
|
||||||
|
幫 `BigBuffer` 加一個 Move constructor:
|
||||||
|
```cpp
|
||||||
|
class BigBuffer {
|
||||||
|
public:
|
||||||
|
...
|
||||||
|
|
||||||
|
BigBuffer(BigBuffer&& src) noexcept {
|
||||||
|
std::cout << "BigBuffer move constructor\n";
|
||||||
|
bufferSize = src.bufferSize;
|
||||||
|
buffer = std::move(src.buffer);
|
||||||
|
|
||||||
|
src.buffer.reset();
|
||||||
|
src.bufferSize = 0;
|
||||||
|
}
|
||||||
|
...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
這個 move constructor 的參數就是一個 rvalue reference,我們把來源的 bufferSize 跟 buffer 指標「移到」我們這邊,而不是完整的複製一份。在轉移之後呢,當然也要把來源清空,讓轉移更加明確。
|
||||||
|
|
||||||
|
有了 Move assignment operator 之後,在執行一次原本的程式,你會發現訊息......沒有變,還是一樣呼叫 copy constructor 來複製了100MB 的 buffer,這時我們需要明確的告訴 compiler 我們要「移動」物件,而不是複製它,把原本的程式改為:
|
||||||
|
```cpp
|
||||||
|
BigBuffer buf1;
|
||||||
|
// Do something with buf1
|
||||||
|
// Assign to buf2
|
||||||
|
BigBuffer buf2 = std::move(buf1);
|
||||||
|
```
|
||||||
|
|
||||||
|
我們用 `std::move()` 來「移動」物件,這時輸出變成
|
||||||
|
```
|
||||||
|
BigBuffer constructor // create buf1
|
||||||
|
BigBuffer move constructor // move buf1 to buf2, buf1 has nullptr now
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
另外一個情形也可以受益於此,假如我們有個 function 會產生 `BigBuffer`,如下:
|
||||||
|
```cpp
|
||||||
|
BigBuffer BigBufferCreator() {
|
||||||
|
std::cout << "BigBufferCreator: Create a BigBuffer!\n";
|
||||||
|
BigBuffer tempb;
|
||||||
|
// do something
|
||||||
|
std::cout << "BigBufferCreator: return\n";
|
||||||
|
return tempb;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigBuffer b = BigBufferCreator(); // copy tempb to b
|
||||||
|
```
|
||||||
|
|
||||||
|
在沒有 Move constructor 的情況下,上面的程式會先產生一個 `tempb`,然後複製給 `b`,訊息:
|
||||||
|
```
|
||||||
|
BigBufferCreator: Create a BigBuffer!
|
||||||
|
BigBuffer constructor
|
||||||
|
BigBufferCreator: return
|
||||||
|
BigBuffer copy constructor, copy 104857600Bytes // Copy 100MB!
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
在有 Move constructor 的情況下,訊息就變成:
|
||||||
|
```
|
||||||
|
BigBufferCreator: Create a BigBuffer!
|
||||||
|
BigBuffer constructor
|
||||||
|
BigBufferCreator: return
|
||||||
|
BigBuffer move constructor // Use MOVE!
|
||||||
|
BigBuffer destructor
|
||||||
|
BigBuffer destructor
|
||||||
|
```
|
||||||
|
|
||||||
|
因為 `BigBufferCreator()` 產生的就是一個 `BigBuffer` rvalue,所以 compiler 會使用 move constructor(`BigBuffer(BigBuffer&& src)`) 而不是 copy constructor。
|
||||||
|
|
||||||
|
## Move assignment operator(`=`)
|
||||||
|
Move assignment operator 的行為跟 move constructor 是一樣的,幫 `BigBuffer` 加入 move assignment operator:
|
||||||
|
```cpp
|
||||||
|
class BigBuffer {
|
||||||
|
public:
|
||||||
|
...
|
||||||
|
|
||||||
|
BigBuffer& operator=(BigBuffer&& src) noexcept {
|
||||||
|
std::cout << "BigBuffer move operator\n";
|
||||||
|
bufferSize = src.bufferSize;
|
||||||
|
buffer = std::move(src.buffer);
|
||||||
|
|
||||||
|
src.buffer.reset();
|
||||||
|
src.bufferSize = 0;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
測試程式:
|
||||||
|
```cpp
|
||||||
|
BigBuffer b1, b2;
|
||||||
|
b2 = b1;
|
||||||
|
```
|
||||||
|
|
||||||
|
訊息:
|
||||||
|
```
|
||||||
|
BigBuffer constructor
|
||||||
|
BigBuffer constructor
|
||||||
|
BigBuffer copy operator, copy 104857600Bytes
|
||||||
|
```
|
||||||
|
|
||||||
|
還是使用 copy assignment operator 來複製,理由是一樣的,需要一個明確的 `std::move()` 來表示「轉移」的行動,把程式改成:
|
||||||
|
```cpp
|
||||||
|
BigBuffer b1, b2;
|
||||||
|
b2 = std::move(b1);
|
||||||
|
```
|
||||||
|
|
||||||
|
這樣就可以了。訊息:
|
||||||
|
```
|
||||||
|
BigBuffer constructor
|
||||||
|
BigBuffer constructor
|
||||||
|
BigBuffer move operator // Use MOVE!
|
||||||
|
```
|
||||||
|
|
||||||
|
## 參考
|
||||||
|
- [Value categories - cppreference.com](https://en.cppreference.com/w/cpp/language/value_category)
|
||||||
|
- [rvalue 參考](https://openhome.cc/Gossip/CppGossip/RvalueReference.html)
|
||||||
|
- [Move constructors - cppreference.com](https://en.cppreference.com/w/cpp/language/move_constructor)
|
||||||
|
- [Move assignment operator - cppreference.com](https://en.cppreference.com/w/cpp/language/move_assignment)
|
||||||
@@ -89,6 +89,16 @@ std::unique_ptr<int> ptr2 = ptr1; // Error
|
|||||||
在Visual Studio 2017上,錯誤訊息是這樣:`error C2280: 'std::unique_ptr<int,std::default_delete<int>>::unique_ptr(const std::unique_ptr<int,std::default_delete<int>> &)': attempting to reference a deleted function`。
|
在Visual Studio 2017上,錯誤訊息是這樣:`error C2280: 'std::unique_ptr<int,std::default_delete<int>>::unique_ptr(const std::unique_ptr<int,std::default_delete<int>> &)': attempting to reference a deleted function`。
|
||||||
其實就是`unique_ptr`的copy constructor跟assignment operator都被標記為delete了。
|
其實就是`unique_ptr`的copy constructor跟assignment operator都被標記為delete了。
|
||||||
|
|
||||||
|
### Move a unique_ptr
|
||||||
|
如果一定要把 `unique_ptr` 指定給別人可以嗎?可以的,用 `std::move()` 來轉移:
|
||||||
|
```cpp
|
||||||
|
auto ptr1 = std::make_unique<int>(5);
|
||||||
|
// do something
|
||||||
|
auto anotherPtr = std::move(ptr1);
|
||||||
|
```
|
||||||
|
|
||||||
|
`ptr1` 原本所管理的指標會轉移給 `anotherPtr``,ptr1` 會變成 `nullptr。`
|
||||||
|
|
||||||
|
|
||||||
## shared_ptr
|
## shared_ptr
|
||||||
建立一個 `shared_ptr` 是使用[`std::make_shared()`](https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared):
|
建立一個 `shared_ptr` 是使用[`std::make_shared()`](https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared):
|
||||||
|
|||||||
Reference in New Issue
Block a user