From ca282beae64348da759d490797eccd3f51e448fc Mon Sep 17 00:00:00 2001 From: Simon Marchetto Date: Fri, 19 Jul 2013 17:31:59 +0200 Subject: [PATCH] Scilab: add bool type in STL vector example --- .../std_vector_as_function_argument/example.cpp | 12 ++++++++++++ .../std_vector_as_function_argument/example.hxx | 4 ++++ .../std_vector_as_function_argument/example.i | 1 + .../std_vector_as_function_argument/runme.sci | 11 +++++++++++ 4 files changed, 28 insertions(+) diff --git a/Examples/scilab/std_vector/std_vector_as_function_argument/example.cpp b/Examples/scilab/std_vector/std_vector_as_function_argument/example.cpp index 779a74cbd..c5d8c153a 100644 --- a/Examples/scilab/std_vector/std_vector_as_function_argument/example.cpp +++ b/Examples/scilab/std_vector/std_vector_as_function_argument/example.cpp @@ -63,6 +63,18 @@ std::vector concat_string_vector(const std::vector vec return concat_vector(vector, other_vector); } +// bool vectors + +std::vector create_bool_vector(const int size, const bool value) +{ + return std::vector(size, value); +} + +std::vector concat_bool_vector(const std::vector vector, const std::vector other_vector) +{ + return concat_vector(vector, other_vector); +} + // pointer (on objects) vectors std::vector create_classA_vector(const int size, const int value) diff --git a/Examples/scilab/std_vector/std_vector_as_function_argument/example.hxx b/Examples/scilab/std_vector/std_vector_as_function_argument/example.hxx index 1db601e6f..efe6b6e4f 100644 --- a/Examples/scilab/std_vector/std_vector_as_function_argument/example.hxx +++ b/Examples/scilab/std_vector/std_vector_as_function_argument/example.hxx @@ -18,6 +18,10 @@ std::vector concat_integer_vector(const std::vector vector, const std: std::vector create_string_vector(const int size, const char* value); std::vector concat_string_vector(const std::vector vector, const std::vector other_vector); +// bool vectors +std::vector create_bool_vector(const int size, const bool value); +std::vector concat_bool_vector(const std::vector vector, const std::vector other_vector); + // pointer (on objects) vectors class classA { diff --git a/Examples/scilab/std_vector/std_vector_as_function_argument/example.i b/Examples/scilab/std_vector/std_vector_as_function_argument/example.i index 113b5639e..92c9a321c 100644 --- a/Examples/scilab/std_vector/std_vector_as_function_argument/example.i +++ b/Examples/scilab/std_vector/std_vector_as_function_argument/example.i @@ -14,6 +14,7 @@ namespace std %template(IntVector) vector; %template(DoubleVector) vector; %template(StringVector) vector; + %template(BoolVector) vector; %template(ClassAVector) vector; } diff --git a/Examples/scilab/std_vector/std_vector_as_function_argument/runme.sci b/Examples/scilab/std_vector/std_vector_as_function_argument/runme.sci index 1148be73d..a463054e6 100644 --- a/Examples/scilab/std_vector/std_vector_as_function_argument/runme.sci +++ b/Examples/scilab/std_vector/std_vector_as_function_argument/runme.sci @@ -44,6 +44,17 @@ disp("concat this vector with the vector of string {''bb'', ''bb''} with concat_ sv3 = concat_string_vector(sv, sv2); disp(sv3); +// bool vectors + +disp("Example of passing matrices of bool as vector arguments of C++ functions."); +disp("get a vector of bool {true, true} with create_bool_vector():"); +bv = create_bool_vector(2, %T); +disp(bv); +bv2 = create_bool_vector(3, %F); +disp("concat this vector with the vector of bool {false, false, false} with concat_bool_vector():"); +bv3 = concat_bool_vector(bv, bv2); +disp(bv3); + // pointer (on object) vectors disp("Example of passing list of objects as vector arguments of C++ functions.");