acme
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages Concepts
_template_inline_functions.h
1// Created by camilo on 2022-11-08 23:10 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5template < primitive_number NUMBER1, primitive_number NUMBER2 >
6void cast_copy(NUMBER1 & n1, NUMBER2 n2)
7{
8
9 n1 = (NUMBER1) n2;
10
11}
12
13
14template < typename A, typename B >
15inline void swap(A & a, B & b)
16{
17
18 auto t = a;
19
20 a = b;
21
22 b = t;
23
24}
25
26
27template < typename TYPE >
28constexpr memsize index_of(const TYPE * p, const TYPE * pBegin)
29{
30
31 return ::is_set(p) ? (::memsize)(p - pBegin) : -1;
32
33}
34
35
36template < primitive_character CHARACTER >
37constexpr bool string_compare_prefix(::std::strong_ordering & ordering, const CHARACTER * pszA, const CHARACTER * pszB) noexcept
38{
39
40 if (::is_empty(pszA))
41 {
42
43 if (::is_empty(pszB))
44 {
45
46 ordering = ::std::strong_ordering::equal;
47
48 return true;
49
50 }
51 else
52 {
53
54 ordering = ::std::strong_ordering::less;
55
56 return true;
57
58 }
59
60 }
61 else if (::is_empty(pszB))
62 {
63
64 ordering = ::std::strong_ordering::greater;
65
66 return true;
67
68 }
69
70 return false;
71
72}
73
74
75
78template < typename TYPE >
79void reverse(TYPE * begin, TYPE * end)
80{
81
82 while (true)
83 {
84
85 end--;
86
87 if (end <= begin) return;
88
89 ::swap(*begin, *end);
90
91 begin++;
92
93 }
94
95}
96
97#include "acme/prototype/collection/pair.h"
98//template < typename A, typename B >
99//struct as_p
100//{
101// A a; B b; };
102//
103
104//template<typename A, typename B>
105//auto as_ab(A a, B b)
106//{
107//
108// return _as_ab<A, B>{a, b};
109//
110//}
111
112//auto f() { return many{ string(),5.7, unmovable() }; };
113
114
115template < primitive_signed SIGNED >
116constexpr auto as_absolute_unsigned(SIGNED i)
117{
118
119 bool bNegative;
120
121 return ::make_pair{ (typename std::make_unsigned<SIGNED>::type) ((bNegative = i < 0) ? -i : i), bNegative };
122
123}
124//::pair<int, int> ia;
125//inline unsigned long long make64_from32(unsigned int l, unsigned int h)
126//{
127//
128// return ((unsigned long long)l) | (((unsigned long long)h) << 32);
129//
130//}
131//
132//
133//inline bool is_memory_segment_ok(const void* p, memsize size, bool bReadWrite)
134//{
135//
136//#ifdef DEEP_DEBUG
137//
138// unsigned char* pbyte = (unsigned char*)p;
139//
140// if (bReadWrite)
141// {
142//
143// for (::collection::index i = 0; i < size; i++)
144// {
145//
146// unsigned char& b = *pbyte;
147//
148// b++; // tests read/write of unsigned char b
149//
150// b--; // restablish it
151//
152// }
153//
154// }
155// else
156// {
157//
158// int sum = 0;
159//
160// for (::collection::index i = 0; i < size; i++)
161// {
162//
163// unsigned char& b = *pbyte;
164//
165// sum += b; // tests read of unsigned char b
166//
167// }
168//
169// }
170//
171//#endif // DEEP_DEBUG
172//
173// return ::is_set(p);
174//
175//}
176//
177//
178//inline bool is_string_ok(const ::wide_character* pwsz, memsize nMaxLength)
179//{
180//
181// return ::is_memory_segment_ok(pwsz, nMaxLength);
182//
183//}
184//
185//
186//inline bool is_string_ok(const ::scoped_string & scopedstr, memsize nMaxLength)
187//{
188//
189// return ::is_memory_segment_ok(psz, nMaxLength);
190//
191//}
192//
193//
194//
195//inline int_bool address_overlaps(const void* pszDst, const void* pszSrc, character_count srclen)
196//{
197//
198// return (((unsigned char*)pszSrc) <= ((unsigned char*)pszDst) && ((unsigned char*)pszSrc) + srclen > ((unsigned char*)pszDst))
199// || (((unsigned char*)pszDst) <= ((unsigned char*)pszSrc) && ((unsigned char*)pszDst) + srclen > ((unsigned char*)pszSrc));
200//
201//}
202//
203
204
205//template < typename TYPE > inline TYPE*& __defer_new(TYPE*& p)
206//{
207//
208// if (!p) p = __allocate TYPE();
209//
210// return p;
211//
212//}
213
214
215inline const ::particle * context_trace_object() { return general_trace_object(); }
216
217
218#ifdef CPP17
219
220template <typename PRED, typename ... Args >
221inline bool _returns_true(PRED pred, const true_type& predicate_returns_void, bool bOnVoid, Args... args)
222{
223 pred(args...);
224 return bOnVoid;
225}
226
227template <typename PRED, typename ... Args >
228inline bool _returns_true(PRED pred, const false_type& predicate_returns_void, bool, Args... args)
229{
230 return (bool)pred(args...);
231}
232
233template <typename PRED, typename ... Args >
234inline bool returns_true(PRED pred, bool bOnVoid, Args... args)
235{
236
237 return _returns_true(pred, is_void<decltype(pred(args...))>, bOnVoid, args...);
238
239}
240
241template <typename PRED, typename ... Args >
242inline bool _returns_false(PRED pred, const true_type& predicate_returns_void, bool bOnVoid, Args... args)
243{
244 pred(args...);
245 return bOnVoid;
246}
247
248template <typename PRED, typename ... Args >
249inline bool _returns_false(PRED pred, const false_type& predicate_returns_void, bool, Args... args)
250{
251 return !(bool)pred(args...);
252}
253
254template <typename PRED, typename ... Args >
255inline bool returns_false(PRED pred, bool bOnVoid, Args... args)
256{
257
258 return _returns_false(pred, is_void < decltype(pred(args...)) >, bOnVoid, args...);
259
260}
261
262#endif
263
264//
265//
266//inline const ::particle* trace_object(const ::particle* pparticle) { return pparticle; }
267//
268//
269//inline bool failed(const ::payload& payload) { return !::succeeded(payload); }
270//
271//
272//
273//inline int read_char(unsigned char*& pdata, memsize& s, char* pch)
274//{
275//
276// if (s < 1)
277// {
278//
279// return 0;
280//
281// }
282//
283// *pch = (char)*pdata;
284//
285// pdata++;
286//
287// s--;
288//
289// return 1;
290//
291//}
292//
293
294
295
296
297template < typename TYPE >
298inline bool is_reference_null(const TYPE& t)
299{
300
301 return is_null(&t);
302
303}
304
305
306template < typename TYPE >
307inline bool is_reference_set(const TYPE& t)
308{
309
310 return is_set(&t);
311
312}
313
314//
315//
316//inline bool is_impact_group(unsigned long long u, unsigned long long uGroup) { return u >= uGroup && u < uGroup + 1000; }
317//
318//
319//inline bool is_impact_subgroup(unsigned long long u, unsigned long long uGroup) { return u >= uGroup && u < uGroup + 100; }
320//
321//
322//inline bool is_file_or_folder(const ::file::enum_type& etype)
323//{
324//
325// return (etype & ::file::e_type_file_or_folder) > ::file::e_type_exists;
326//
327//}
328//
329//
330//inline bool exists(const ::file::enum_type& etype)
331//{
332//
333// return etype & ::file::e_type_exists;
334//
335//}
336//
337
338template < class T >
339inline void __dynamic_cast(T*& ptarget, T* psource)
340{
341
342 ptarget = psource;
343
344}
345
346
347template < class T , typename T2 >
348inline void __dynamic_cast(T * & ptarget, T2 * psource)
349{
350
351 ptarget = dynamic_cast < T * >(psource);
352
353}
354
355
356template < typename T1, typename T2 >
357inline bool __sort(T1& t1, T2& t2)
358{
359
360 if (t2 >= t1)
361 {
362
363 return false;
364
365 }
366
367 auto t = t2;
368
369 t2 = t1;
370
371 t1 = t;
372
373 return true;
374
375}
376
377
378//
379//
380//
381//
382//
383//inline long long ansi_to_long_long(const ::ansi_character * psz, const ::ansi_character ** ppszEnd, int iBase)
384//{
385//
386// return strtoll(psz, (::ansi_character **) ppszEnd, iBase);
387//
388//}
389//
390//inline unsigned long long ansi_to_unsigned_long_long(const ::ansi_character * psz, const ::ansi_character ** ppszEnd, int iBase)
391//{
392//
393// return strtoull(psz, (::ansi_character **) ppszEnd, iBase);
394//
395//}
396//
397//
398//inline int ansi_to_int(const ::ansi_character * psz, const ::ansi_character ** ppszEnd, int iBase)
399//{
400//
401//#ifdef WINDOWS
402//
403// return strtol(psz, (::ansi_character **) ppszEnd, iBase);
404//
405//#else
406//
407// long l = strtol(psz, (::ansi_character **) ppszEnd, iBase);
408//
409// if(l > INT_MAX)
410// {
411//
412// errno = ERANGE;
413//
414// return INT_MAX;
415//
416// }
417// else if(l < INT_MIN)
418// {
419//
420// errno = ERANGE;
421//
422// return INT_MIN;
423//
424// }
425//
426// return (int) l;
427//
428//#endif
429//
430//}
431//
432//
433//inline unsigned int ansi_to_unsigned_int(const ::ansi_character * psz, const ::ansi_character ** ppszEnd, int iBase)
434//{
435//
436//#ifdef WINDOWS
437//
438// return strtoul(psz, (::ansi_character **) ppszEnd, iBase);
439//
440//#else
441//
442// unsigned long ul = strtoul(psz, (::ansi_character **) ppszEnd, iBase);
443//
444// if(ul > UINT_MAX)
445// {
446//
447// errno = ERANGE;
448//
449// return UINT_MAX;
450//
451// }
452//
453// return (unsigned int) ul;
454//
455//#endif
456//
457//}
458//
459//
460
461template < primitive_integral SECOND, primitive_integral NANOSECOND >
462constexpr void normalize_second_nanosecond(SECOND & second, NANOSECOND & nanosecond)
463{
464
465 auto extrasecond = nanosecond > 0 ? (nanosecond / 1'000'000'000) : ((nanosecond / 1'000'000'000) - 1);
466
467 second += extrasecond;
468
469 nanosecond -= extrasecond * 1'000'000'000;
470
471}
472
473
474
475template < primitive_integral SECOND1, primitive_integral NANOSECOND1, primitive_integral SECOND2, primitive_integral NANOSECOND2 >
476constexpr void add_second_nanosecond(SECOND1 & second1, NANOSECOND1 & nanosecond1, const SECOND2 & second2, const NANOSECOND2 & nanosecond2)
477{
478
479 auto nanos = nanosecond1 + nanosecond2;
480
481 auto extrasecond = nanos > 0 ? (nanos / 1'000'000'000) : ((nanos / 1'000'000'000) - 1);
482
483 second1 = second1 + second2 + extrasecond;
484
485 nanosecond1 = nanos - extrasecond * 1'000'000'000;
486
487}
488
489
490
491template < primitive_integral SECOND1, primitive_integral NANOSECOND1, primitive_integral SECOND2, primitive_integral NANOSECOND2 >
492constexpr void subtract_second_nanosecond(SECOND1 & second1, NANOSECOND1 & nanosecond1, const SECOND2 & second2, const NANOSECOND2 & nanosecond2)
493{
494
495 auto nanos = nanosecond1 - nanosecond2;
496
497 auto extrasecond = nanos > 0 ? (nanos / 1'000'000'000) : ((nanos / 1'000'000'000) - 1);
498
499 second1 = second1 - second2 + extrasecond;
500
501 nanosecond1 = nanos - extrasecond * 1'000'000'000;
502
503}
504
505
506template < typename TYPE >
507constexpr TYPE * find_first_null_character(TYPE * p)
508{
509
510 TYPE t{};
511
512 while (*p != t)
513 {
514
515 p++;
516
517 }
518
519 return p;
520
521}
522
523
524template < typename TYPE, ::comparison::equality < TYPE > EQUALITY >
525constexpr const TYPE * find_first_null_character(const TYPE * p, EQUALITY equality)
526{
527
528 TYPE t{};
529
530 while (!equality.equals(*p, t))
531 {
532
533 p++;
534
535 }
536
537 return p;
538
539}
540
541
542template < primitive_fundamental INTEGRAL >
543constexpr ::collection::count count_until_zero_item_type(const INTEGRAL * p)
544{
545
546 ::collection::count c = 0;
547
548 while (*p)
549 {
550
551 p++;
552
553 c++;
554
555 }
556
557 return c;
558
559}
560
561
562
563template < primitive_character CHARACTER >
564constexpr void null_terminate(CHARACTER * & p)
565{
566
567 *p = (CHARACTER)0;
568
569}
570
571
572template < primitive_character CHARACTER >
573constexpr void append_and_step_if_true(bool b, CHARACTER *& p, CHARACTER character)
574{
575
576 if (b) *p++ = character;
577
578}
579
580
581
582template < primitive_iterator ITERATOR, primitive_iterator BEGIN >
583constexpr bool iterator_is_before_begin(ITERATOR p, BEGIN)
584{
585
586 return p.is_null();
587
588}
589
590
591
592template < primitive_iterator ITERATOR, primitive_iterator END >
593constexpr bool iterator_is_end(ITERATOR p, END)
594{
595
596 return p.is_null();
597
598}
599
600
601template < primitive_iterator ITERATOR, primitive_iterator BEGIN, primitive_iterator END >
602constexpr bool iterator_is_ok(ITERATOR p, BEGIN, END)
603{
604
605 return p.is_ok();
606
607}
608
609
610template < typename TYPE, typename BEGIN >
611constexpr bool iterator_is_before_begin(const TYPE * p, const BEGIN * begin)
612{
613
614 return p < begin;
615
616}
617
618
619template < typename TYPE, typename END >
620constexpr bool iterator_is_end(const TYPE * p, const END * end)
621{
622
623 return p >= end;
624
625}
626
627
628template < typename TYPE, typename BEGIN, typename END >
629constexpr bool iterator_is_ok(const TYPE * p, const BEGIN * begin, const END * end)
630{
631
632 return p >= begin && p < end;
633
634}
635
636
637template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
638bool is_empty(const ITEM * p, EQUALITY equality)
639{
640
641 return ::is_null(p) || equality.equals(*p, 0);
642
643}
644
645
646template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
647constexpr bool _initialize_null_terminated_contains_null_terminated(bool & b, const ITEM * pz, const ITEM * pzPrefix, EQUALITY equality)
648{
649
650 if (::is_empty(pzPrefix, equality))
651 {
652
653 b = true;
654
655 return true;
656
657 }
658
659 if (::is_empty(pz, equality))
660 {
661
662 b = false;
663
664 return true;
665
666 }
667
668
669 return false;
670
671}
672
673
674template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
675constexpr bool _null_terminated_begins_null_terminated(const ITEM * pz, const ITEM * pzPrefix, EQUALITY equality)
676{
677
678 do
679 {
680
681 if (!equality.equals(*pz, *pzPrefix))
682 {
683
684 return false;
685
686 }
687
688 pz++;
689
690 pzPrefix++;
691
692 } while (!equality.equals(*pz,0) && !equality.equals(*pzPrefix, 0));
693
694 return equality.equals(*pzPrefix, 0);
695
696}
697
698
699template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
700constexpr bool null_terminated_begins_null_terminated(const ITEM * pz, const ITEM * pzPrefix, EQUALITY equality)
701{
702
703 bool b;
704
705 if (_initialize_null_terminated_contains_null_terminated(b, pz, pzPrefix, equality))
706 {
707
708 return b;
709
710 }
711
712 return _null_terminated_begins_null_terminated(pz, pzPrefix, equality);
713
714}
715
716
717#include "acme/prototype/mathematics/_.h"
718
719
720template < typename TYPE >
721TYPE * clipped_add(TYPE * p, ::collection::count c, const non_const<TYPE> * begin, const non_const<TYPE> * end)
722{
723
724 if (c > 0)
725 {
726
727 p = minimum(p + c, end);
728
729 }
730 else
731 {
732
733 p = maximum(p + c, begin - 1);
734
735 }
736
737 return p;
738
739}
740
741
742
743
744
745template < primitive_iterator ITERATOR, typename T1, typename T2 >
746ITERATOR clipped_add(ITERATOR p, ::collection::count c, T1, T2)
747{
748
749 if (c > 0)
750 {
751
752 while (p.is_set() && c > 0)
753 {
754
755 p = p.next();
756
757 c--;
758
759 }
760
761
762 }
763 else
764 {
765
766 while (p.is_set() && c < 0)
767 {
768
769 p = p.back();
770
771 c++;
772
773 }
774
775
776 }
777
778 return p;
779
780}
781
782
783
784template < primitive_signed SIGNED >
785bool found(SIGNED s)
786{
787
788 return s >= 0;
789
790}
791
792
793template < typename T >
794bool found(const T * p)
795{
796
797 return ::is_set(p);
798
799}
800
801
802template < primitive_signed SIGNED >
803bool not_found(SIGNED s)
804{
805
806 return !found(s);
807
808}
809
810
811template < typename T >
812bool not_found(const T * p)
813{
814
815 return !found(p);
816
817}
818
819
820//template < primitive_floating FLOATING, int len >
821//inline ::string as_string(FLOATING f, const ::ansi_character * pszFormat = "%f");
822
823
824template < typename BOOLEAN, typename ASSIGNED, typename ASSIGNEE >
825inline void set_if_different(BOOLEAN& bSetIfChanged, ASSIGNED& left, const ASSIGNEE& right)
826{
827
828 if (left != right)
829 {
830
831 bSetIfChanged = true;
832
833 left = right;
834
835 }
836
837}
838
839
840
841template < primitive_XYDim XYDim, typename X, typename Y, typename W, typename H >
842inline XYDim & set_dim(XYDim & rectTarget, X x, Y y, W w, H h)
843{
844
845 cast_copy(rectTarget.X, x);
846 cast_copy(rectTarget.Y, y);
847 cast_copy(rectTarget.Width, w);
848 cast_copy(rectTarget.Height, h);
849
850 return rectTarget;
851
852}
853
854
855//template < primitive_rectangle RECTANGLE1, primitive_rectangle RECTANGLE2 >
856//void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
857//{
858//
859// cast_copy(rectangle1.left() , rectangle2.left() );
860// cast_copy(rectangle1.top() , rectangle2.top() );
861// cast_copy(rectangle1.right() , rectangle2.right() );
862// cast_copy(rectangle1.bottom() , rectangle2.bottom() );
863//
864//}
865
866
867template < primitive_rectangle RECTANGLE, primitive_xydim XYDIM >
868void copy(RECTANGLE & rectangle, const XYDIM & xydim)
869{
870
871 cast_copy(rectangle.left() , xydim.x);
872 cast_copy(rectangle.top() , xydim.y);
873 cast_copy(rectangle.right() , xydim.x + xydim.width);
874 cast_copy(rectangle.bottom() , xydim.y + xydim.height);
875
876}
877
878
879template < primitive_origin_size ORIGIN_SIZE, primitive_rectangle RECTANGLE >
880void copy(ORIGIN_SIZE & originsize, const RECTANGLE & rectangle)
881{
882
883 cast_copy(originsize.origin.x , rectangle.left());
884 cast_copy(originsize.origin.y , rectangle.top());
885 cast_copy(originsize.size.width , rectangle.right() - rectangle.left());
886 cast_copy(originsize.size.height , rectangle.bottom() - rectangle.top());
887
888}
889
890
891template < primitive_rectangle RECTANGLE1, primitive_origin_size RECTANGLE2 >
892void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
893{
894
895 cast_copy(rectangle1.left() , rectangle2.origin.x);
896 cast_copy(rectangle1.top() , rectangle2.origin.y);
897 cast_copy(rectangle1.right() , rectangle2.origin.x + rectangle2.size.width);
898 cast_copy(rectangle1.bottom() , rectangle2.origin.y + rectangle2.size.height);
899
900}
901
902
903// template < primitive_rectangle RECTANGLE, origin_size ORIGIN_SIZE >
904// constexpr void copy(RECTANGLE& rectangle, const ORIGIN_SIZE& origin_size)
905// {
906
907// rectangle.left() = (decltype(rectangle.left()))origin_size.origin.x();
908// rectangle.top() = (decltype(rectangle.top()))origin_size.origin.y();
909// rectangle.right() = (decltype(rectangle.right()))(origin_size.origin.x() + origin_size.size.width);
910// rectangle.bottom() = (decltype(rectangle.bottom()))(origin_size.origin.y() + origin_size.size.height);
911
912// }
913
914
915// template < origin_size ORIGIN_SIZE, primitive_rectangle RECTANGLE >
916// constexpr void copy(ORIGIN_SIZE& origin_size, const RECTANGLE& rectangle)
917// {
918
919// origin_size.origin.x() = (decltype(origin_size.origin.x()))rectangle.left();
920// origin_size.origin.y() = (decltype(origin_size.origin.y()))rectangle.top();
921// origin_size.size.width = (decltype(origin_size.size.width))(rectangle.right() - rectangle.left());
922// origin_size.size.height = (decltype(origin_size.size.height))(rectangle.bottom() - rectangle.top());
923
924// }
925
926
927
928
929
930
931
932template < primitive_XY POINT1, primitive_point POINT2 >
933void copy(POINT1 point1, const POINT2 & point2)
934{
935
936 cast_copy(point1.X, point2.x());
937 cast_copy(point1.Y, point2.y());
938
939}
940
941
942template < primitive_point POINT1, primitive_XY POINT2 >
943void copy(POINT1 & point1, const POINT2 & point2)
944{
945
946 cast_copy(point1.x(), point2.X);
947 cast_copy(point1.y(), point2.Y);
948
949}
950
951
952template < primitive_rectangle RECTANGLE1, primitive_rectangle RECTANGLE2 >
953void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
954{
955
956 cast_copy(rectangle1.left(), rectangle2.left());
957 cast_copy(rectangle1.top(), rectangle2.top());
958 cast_copy(rectangle1.right(), rectangle2.right());
959 cast_copy(rectangle1.bottom(), rectangle2.bottom());
960
961}
962
963
964template < primitive_XYDim XYDim, primitive_rectangle RECTANGLE >
965void copy(XYDim & xydim, const RECTANGLE & rectangle)
966{
967
968 cast_copy(xydim.X, rectangle.left());
969 cast_copy(xydim.Y, rectangle.top());
970 cast_copy(xydim.Width, rectangle.right() - rectangle.left());
971 cast_copy(xydim.Height, rectangle.bottom() - rectangle.top());
972
973}
974
975
976template < primitive_rectangle RECTANGLE, primitive_XYDim XYDim >
977void copy(RECTANGLE & rectangle, const XYDim & xydim)
978{
979
980 cast_copy(rectangle.left(), xydim.X);
981 cast_copy(rectangle.top(), xydim.Y);
982 cast_copy(rectangle.right(), xydim.X + xydim.Width);
983 cast_copy(rectangle.bottom(), xydim.Y + xydim.Height);
984
985}
986
987
988template < primitive_xydim XYDIM, primitive_rectangle RECTANGLE >
989void copy(XYDIM & xydim, const RECTANGLE & rectangle)
990{
991
992 cast_copy(xydim.x, rectangle.left());
993 cast_copy(xydim.y, rectangle.top());
994 cast_copy(xydim.width, rectangle.right() - rectangle.left());
995 cast_copy(xydim.height, rectangle.bottom() - rectangle.top());
996
997}
998
999
1000template < primitive_XYDim XYDim1, primitive_XYDim XYDim2 >
1001void copy(XYDim1 & xydim1, const XYDim2 & xydim2)
1002{
1003
1004 cast_copy(xydim1.X, xydim2.X);
1005 cast_copy(xydim1.Y, xydim2.Y);
1006 cast_copy(xydim1.Width, xydim2.Width);
1007 cast_copy(xydim1.Height, xydim2.Height);
1008
1009}
1010
1011
1012template < primitive_point POINT1, primitive_point POINT2 >
1013void copy(POINT1 & point1, const POINT2 & point2)
1014{
1015
1016 cast_copy(point1.x(), point2.x());
1017 cast_copy(point1.y(), point2.y());
1018
1019}
1020
1021
1022template < primitive_point POINT1, raw_primitive_point POINT2 >
1023void copy(POINT1 & point1, const POINT2 & point2)
1024{
1025
1026 cast_copy(point1.x(), point2.x());
1027 cast_copy(point1.y(), point2.y());
1028
1029}
1030
1031
1032template < raw_primitive_point POINT1, primitive_point POINT2 >
1033void copy(POINT1 & point1, const POINT2 & point2)
1034{
1035
1036 cast_copy(point1.x, point2.x());
1037 cast_copy(point1.y, point2.y());
1038
1039}
1040
1041
1042template < primitive_point POINT, primitive_size SIZE >
1043void copy(POINT & point, const SIZE & size)
1044{
1045
1046 cast_copy(point.x(), size.cx());
1047 cast_copy(point.y(), size.cy());
1048
1049}
1050
1051
1052template < primitive_size SIZE_TYPE1, primitive_size SIZE_TYPE2 >
1053void copy(SIZE_TYPE1 & size1, const SIZE_TYPE2 & size2)
1054{
1055
1056 cast_copy(size1.cx(), size2.cx());
1057 cast_copy(size1.cy(), size2.cy());
1058
1059}
1060
1061
1062template < typename CHAR_STRING >
1063inline bool is_string_empty(CHAR_STRING p) { return ::is_null(p) || *p == '\0'; }
1064
1065
Definition aaa_character.h:10
Definition aaa_nanosecond.h:9
Definition aaa_second.h:9