3#ifndef _aspose_system_casts_h_
4#define _aspose_system_casts_h_
6#include <system/collections/ienumerable.h>
7#include <system/collections/list.h>
8#include <system/object_ext.h>
9#include <system/shared_ptr.h>
10#include <system/weak_ptr.h>
11#include <system/array.h>
20template<
class To,
class From>
21typename std::enable_if<!System::detail::has_method_get_Count<From>::value,
24 auto result = MakeObject<Collections::Generic::List<To>>();
26 auto enumerator = enumerable->GetEnumerator();
27 while (enumerator->MoveNext())
29 const auto& item = ExplicitCast<To>(enumerator->get_Current());
41template<
class To,
class From>
42typename std::enable_if<System::detail::has_method_get_Count<From>::value,
45 auto result = MakeObject<Collections::Generic::List<To>>(enumerable->get_Count());
47 auto enumerator = enumerable->GetEnumerator();
48 while (enumerator->MoveNext())
50 const auto& item = ExplicitCast<To>(enumerator->get_Current());
65template<
typename To,
typename From>
69 return ExplicitCast<System::ArrayPtr<To>>(from);
79template<
typename To,
typename From>
83 return ExplicitCast<System::ArrayPtr<To>>(from);
92template<
class To,
class From>
95 return ExplicitCast<System::ArrayPtr<To>>(from);
Class that represents an array data structure. Objects of this class should only be allocated using S...
Definition: array.h:259
List pointer with access operators. This type is a pointer to manage other object's deletion....
Definition: list.h:38
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Definition: db_command.h:9
std::enable_if<!System::detail::has_method_get_Count< From >::value, Collections::Generic::ListPtr< To > >::type CastEnumerableTo(const From &enumerable)
Performs the explicit casting of elements of the specified enumerable object to different type.
Definition: special_casts.h:22
std::enable_if_t< System::IsSmartPtr< From >::value, System::SharedPtr< System::Array< To > > > StaticCastArray(const System::SharedPtr< System::Array< From > > &from)
Performs casting of elements of the specified array to different type. Override for cases then From i...
Definition: special_casts.h:67
SharedPtr< Array< To > > DynamicCastArray(const SharedPtr< Array< From > > &from)
Performs casting of elements of the specified array to different type.
Definition: special_casts.h:93
Template predicate that checks if boxing of the specified type is supported.
Definition: boxable_traits.h:16