[Bf-blender-cvs] [aea26830dc7] master: Cleanup: use std::get instead of std::get_if

Jacques Lucke noreply at git.blender.org
Sat Jan 14 14:16:59 CET 2023


Commit: aea26830dc7b7f68508ad93d07e538652b767903
Author: Jacques Lucke
Date:   Sat Jan 14 14:16:51 2023 +0100
Branches: master
https://developer.blender.org/rBaea26830dc7b7f68508ad93d07e538652b767903

Cleanup: use std::get instead of std::get_if

`std::get` could not be used due to restrictions on macos.
However, the minimum requirement has been lifted in
{rB597aecc01644f0063fa4545dabadc5f73387e3d3}.

===================================================================

M	source/blender/functions/FN_multi_function_params.hh

===================================================================

diff --git a/source/blender/functions/FN_multi_function_params.hh b/source/blender/functions/FN_multi_function_params.hh
index caf43714e50..9865a62df1b 100644
--- a/source/blender/functions/FN_multi_function_params.hh
+++ b/source/blender/functions/FN_multi_function_params.hh
@@ -160,7 +160,7 @@ class ParamsBuilder {
     BLI_assert(ELEM(signature_->params[param_index].type.category(),
                     ParamCategory::SingleOutput,
                     ParamCategory::SingleMutable));
-    return *std::get_if<GMutableSpan>(&actual_params_[param_index]);
+    return std::get<GMutableSpan>(actual_params_[param_index]);
   }
 
   GVectorArray &computed_vector_array(int param_index)
@@ -168,7 +168,7 @@ class ParamsBuilder {
     BLI_assert(ELEM(signature_->params[param_index].type.category(),
                     ParamCategory::VectorOutput,
                     ParamCategory::VectorMutable));
-    return **std::get_if<GVectorArray *>(&actual_params_[param_index]);
+    return *std::get<GVectorArray *>(actual_params_[param_index]);
   }
 
   ResourceScope &resource_scope()
@@ -229,7 +229,7 @@ class MFParams {
   const GVArray &readonly_single_input(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::SingleInput);
-    return *std::get_if<GVArray>(&builder_->actual_params_[param_index]);
+    return std::get<GVArray>(builder_->actual_params_[param_index]);
   }
 
   /**
@@ -241,7 +241,7 @@ class MFParams {
   bool single_output_is_required(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::SingleOutput);
-    return !std::get_if<GMutableSpan>(&builder_->actual_params_[param_index])->is_empty();
+    return !std::get<GMutableSpan>(builder_->actual_params_[param_index]).is_empty();
   }
 
   template<typename T>
@@ -252,7 +252,7 @@ class MFParams {
   GMutableSpan uninitialized_single_output(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::SingleOutput);
-    GMutableSpan span = *std::get_if<GMutableSpan>(&builder_->actual_params_[param_index]);
+    GMutableSpan span = std::get<GMutableSpan>(builder_->actual_params_[param_index]);
     if (!span.is_empty()) {
       return span;
     }
@@ -273,7 +273,7 @@ class MFParams {
   GMutableSpan uninitialized_single_output_if_required(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::SingleOutput);
-    return *std::get_if<GMutableSpan>(&builder_->actual_params_[param_index]);
+    return std::get<GMutableSpan>(builder_->actual_params_[param_index]);
   }
 
   template<typename T>
@@ -285,7 +285,7 @@ class MFParams {
   const GVVectorArray &readonly_vector_input(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::VectorInput);
-    return **std::get_if<const GVVectorArray *>(&builder_->actual_params_[param_index]);
+    return *std::get<const GVVectorArray *>(builder_->actual_params_[param_index]);
   }
 
   template<typename T>
@@ -296,7 +296,7 @@ class MFParams {
   GVectorArray &vector_output(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::VectorOutput);
-    return **std::get_if<GVectorArray *>(&builder_->actual_params_[param_index]);
+    return *std::get<GVectorArray *>(builder_->actual_params_[param_index]);
   }
 
   template<typename T> MutableSpan<T> single_mutable(int param_index, StringRef name = "")
@@ -306,7 +306,7 @@ class MFParams {
   GMutableSpan single_mutable(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::SingleMutable);
-    return *std::get_if<GMutableSpan>(&builder_->actual_params_[param_index]);
+    return std::get<GMutableSpan>(builder_->actual_params_[param_index]);
   }
 
   template<typename T>
@@ -317,7 +317,7 @@ class MFParams {
   GVectorArray &vector_mutable(int param_index, StringRef name = "")
   {
     this->assert_correct_param(param_index, name, ParamCategory::VectorMutable);
-    return **std::get_if<GVectorArray *>(&builder_->actual_params_[param_index]);
+    return *std::get<GVectorArray *>(builder_->actual_params_[param_index]);
   }
 
  private:



More information about the Bf-blender-cvs mailing list