xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
generic_list_convert_all.cpp
Shows how to use
xtd::collections::generic::list::convert_all
method.
#include <xtd/xtd>
using namespace
xtd::drawing
;
class
example {
public
:
static
auto
main() {
auto
lpf = list<point_f> {};
lpf.add(
point_f
{27.8f, 32.62f});
lpf.add(
point_f
{99.3f, 147.273f});
lpf.add(
point_f
{7.5f, 1412.2f});
console::write_line
();
for
(
const
auto
& p : lpf)
console::write_line
(p);
list<point> lp = lpf.convert_all<
point
>(
converter<point, const point_f&>
{point_f_to_point});
console::write_line
();
for
(
const
auto
& p : lp)
console::write_line
(p);
}
static
point
point_f_to_point(
const
point_f
& pf) {
return
{
as<int>
(pf.
x
),
as<int>
(pf.
y
)};
}
};
startup_
(example::main);
// This code produces the following output :
//
//
// {x=27.8, y=32.62}
// {x=99.3, y=147.273}
// {x=7.5, y=1412.2}
//
// {x=28, y=33}
// {x=99, y=147}
// {x=8, y=1412}
xtd::console::write_line
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
xtd::converter
xtd::delegate< output_t(input_t input)> converter
Represents a method that converts an object from one type to another type.
Definition
converter.hpp:33
startup_
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition
startup.hpp:278
xtd::as
auto as(any_object &o) -> type_t
Casts a type into another type.
Definition
__as_any_object.hpp:60
xtd::drawing
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition
actions_system_images.hpp:10
xtd::drawing::point_f
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition
point_f.hpp:35
xtd::drawing::point_f::x
float x
Gets or sets the x-coordinate of this xtd::drawing::point_f.
Definition
point_f.hpp:67
xtd::drawing::point_f::y
float y
Gets or sets the y-coordinate of this xtd::drawing::point_f.
Definition
point_f.hpp:71
xtd::drawing::point
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition
point.hpp:54
Generated on
for xtd by
Gammasoft
. All rights reserved.