PyPartMC 2.1.2__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. PyPartMC/_PyPartMC.pyd +0 -0
  2. PyPartMC/__generate_si.py +37 -0
  3. PyPartMC/__init__.py +78 -0
  4. PyPartMC/cmake/PyPartMCConfig.cmake +65 -0
  5. PyPartMC/include/PyPartMC/aero_binned.hpp +117 -0
  6. PyPartMC/include/PyPartMC/aero_data.hpp +283 -0
  7. PyPartMC/include/PyPartMC/aero_dist.hpp +85 -0
  8. PyPartMC/include/PyPartMC/aero_mode.hpp +359 -0
  9. PyPartMC/include/PyPartMC/aero_particle.hpp +275 -0
  10. PyPartMC/include/PyPartMC/aero_state.hpp +664 -0
  11. PyPartMC/include/PyPartMC/bin_grid.hpp +143 -0
  12. PyPartMC/include/PyPartMC/camp_core.hpp +31 -0
  13. PyPartMC/include/PyPartMC/condense.hpp +35 -0
  14. PyPartMC/include/PyPartMC/env_state.hpp +161 -0
  15. PyPartMC/include/PyPartMC/gas_data.hpp +105 -0
  16. PyPartMC/include/PyPartMC/gas_state.hpp +129 -0
  17. PyPartMC/include/PyPartMC/getters.hpp +55 -0
  18. PyPartMC/include/PyPartMC/input_guard.hpp +155 -0
  19. PyPartMC/include/PyPartMC/json_resource.hpp +363 -0
  20. PyPartMC/include/PyPartMC/output.hpp +96 -0
  21. PyPartMC/include/PyPartMC/photolysis.hpp +29 -0
  22. PyPartMC/include/PyPartMC/pmc_resource.hpp +42 -0
  23. PyPartMC/include/PyPartMC/rand.hpp +12 -0
  24. PyPartMC/include/PyPartMC/run_exact.hpp +34 -0
  25. PyPartMC/include/PyPartMC/run_exact_opt.hpp +46 -0
  26. PyPartMC/include/PyPartMC/run_part.hpp +110 -0
  27. PyPartMC/include/PyPartMC/run_part_opt.hpp +72 -0
  28. PyPartMC/include/PyPartMC/run_sect.hpp +34 -0
  29. PyPartMC/include/PyPartMC/run_sect_opt.hpp +54 -0
  30. PyPartMC/include/PyPartMC/scenario.hpp +220 -0
  31. PyPartMC/include/PyPartMC/si.hpp +118 -0
  32. PyPartMC/include/PyPartMC/util.hpp +22 -0
  33. PyPartMC/include/PyPartMC.hpp +28 -0
  34. PyPartMC/include/aero_data_parameters.hpp +27 -0
  35. PyPartMC/include/bpstd/detail/string_view.inl +925 -0
  36. PyPartMC/include/bpstd/string_view.hpp +498 -0
  37. PyPartMC/include/gas_data_parameters.hpp +14 -0
  38. PyPartMC/include/nanobind_json/nanobind_json.h +226 -0
  39. PyPartMC/include/nlohmann/adl_serializer.hpp +55 -0
  40. PyPartMC/include/nlohmann/byte_container_with_subtype.hpp +103 -0
  41. PyPartMC/include/nlohmann/detail/abi_macros.hpp +100 -0
  42. PyPartMC/include/nlohmann/detail/conversions/from_json.hpp +497 -0
  43. PyPartMC/include/nlohmann/detail/conversions/to_chars.hpp +1118 -0
  44. PyPartMC/include/nlohmann/detail/conversions/to_json.hpp +446 -0
  45. PyPartMC/include/nlohmann/detail/exceptions.hpp +257 -0
  46. PyPartMC/include/nlohmann/detail/hash.hpp +129 -0
  47. PyPartMC/include/nlohmann/detail/input/binary_reader.hpp +3009 -0
  48. PyPartMC/include/nlohmann/detail/input/input_adapters.hpp +492 -0
  49. PyPartMC/include/nlohmann/detail/input/json_sax.hpp +727 -0
  50. PyPartMC/include/nlohmann/detail/input/lexer.hpp +1633 -0
  51. PyPartMC/include/nlohmann/detail/input/parser.hpp +519 -0
  52. PyPartMC/include/nlohmann/detail/input/position_t.hpp +37 -0
  53. PyPartMC/include/nlohmann/detail/iterators/internal_iterator.hpp +35 -0
  54. PyPartMC/include/nlohmann/detail/iterators/iter_impl.hpp +751 -0
  55. PyPartMC/include/nlohmann/detail/iterators/iteration_proxy.hpp +242 -0
  56. PyPartMC/include/nlohmann/detail/iterators/iterator_traits.hpp +61 -0
  57. PyPartMC/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +130 -0
  58. PyPartMC/include/nlohmann/detail/iterators/primitive_iterator.hpp +132 -0
  59. PyPartMC/include/nlohmann/detail/json_custom_base_class.hpp +39 -0
  60. PyPartMC/include/nlohmann/detail/json_pointer.hpp +988 -0
  61. PyPartMC/include/nlohmann/detail/json_ref.hpp +78 -0
  62. PyPartMC/include/nlohmann/detail/macro_scope.hpp +482 -0
  63. PyPartMC/include/nlohmann/detail/macro_unscope.hpp +45 -0
  64. PyPartMC/include/nlohmann/detail/meta/call_std/begin.hpp +17 -0
  65. PyPartMC/include/nlohmann/detail/meta/call_std/end.hpp +17 -0
  66. PyPartMC/include/nlohmann/detail/meta/cpp_future.hpp +171 -0
  67. PyPartMC/include/nlohmann/detail/meta/detected.hpp +70 -0
  68. PyPartMC/include/nlohmann/detail/meta/identity_tag.hpp +21 -0
  69. PyPartMC/include/nlohmann/detail/meta/is_sax.hpp +159 -0
  70. PyPartMC/include/nlohmann/detail/meta/std_fs.hpp +29 -0
  71. PyPartMC/include/nlohmann/detail/meta/type_traits.hpp +795 -0
  72. PyPartMC/include/nlohmann/detail/meta/void_t.hpp +24 -0
  73. PyPartMC/include/nlohmann/detail/output/binary_writer.hpp +1838 -0
  74. PyPartMC/include/nlohmann/detail/output/output_adapters.hpp +147 -0
  75. PyPartMC/include/nlohmann/detail/output/serializer.hpp +988 -0
  76. PyPartMC/include/nlohmann/detail/string_concat.hpp +146 -0
  77. PyPartMC/include/nlohmann/detail/string_escape.hpp +72 -0
  78. PyPartMC/include/nlohmann/detail/value_t.hpp +118 -0
  79. PyPartMC/include/nlohmann/json.hpp +5258 -0
  80. PyPartMC/include/nlohmann/json_fwd.hpp +75 -0
  81. PyPartMC/include/nlohmann/ordered_map.hpp +359 -0
  82. PyPartMC/include/nlohmann/thirdparty/hedley/hedley.hpp +2045 -0
  83. PyPartMC/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +158 -0
  84. PyPartMC/include/output_parameters.hpp +25 -0
  85. PyPartMC/include/tcb/span.hpp +617 -0
  86. PyPartMC/include/tl/optional.hpp +2062 -0
  87. PyPartMC/lib/libpartmclib.a +0 -0
  88. pypartmc-2.1.2.dist-info/METADATA +494 -0
  89. pypartmc-2.1.2.dist-info/RECORD +91 -0
  90. pypartmc-2.1.2.dist-info/WHEEL +5 -0
  91. pypartmc-2.1.2.dist-info/licenses/LICENSE +674 -0
@@ -0,0 +1,925 @@
1
+ #ifndef BPSTD_DETAIL_STRING_VIEW_INL
2
+ #define BPSTD_DETAIL_STRING_VIEW_INL
3
+
4
+ namespace bpstd {
5
+
6
+ //--------------------------------------------------------------------------
7
+ // Constructor
8
+ //--------------------------------------------------------------------------
9
+
10
+ template<typename CharT, typename Traits>
11
+ inline constexpr basic_string_view<CharT,Traits>::basic_string_view()
12
+ noexcept
13
+ : m_str(nullptr),
14
+ m_size(0)
15
+ {
16
+
17
+ }
18
+
19
+ template<typename CharT, typename Traits>
20
+ template<typename Allocator>
21
+ inline basic_string_view<CharT,Traits>::basic_string_view(const std::basic_string<CharT,Traits,Allocator>& str)
22
+ noexcept
23
+ : m_str(str.c_str()),
24
+ m_size(str.size())
25
+ {
26
+
27
+ }
28
+
29
+ template<typename CharT, typename Traits>
30
+ inline constexpr basic_string_view<CharT,Traits>::basic_string_view(const char_type* str)
31
+ noexcept
32
+ : m_str(str),
33
+ m_size(traits_type::length(str))
34
+ {
35
+
36
+ }
37
+
38
+ template<typename CharT, typename Traits>
39
+ inline constexpr basic_string_view<CharT,Traits>::basic_string_view(const char_type* str, size_type count)
40
+ noexcept
41
+ : m_str(str),
42
+ m_size(count)
43
+ {
44
+
45
+ }
46
+
47
+ //--------------------------------------------------------------------------
48
+ // Capacity
49
+ //--------------------------------------------------------------------------
50
+
51
+ template<typename CharT, typename Traits>
52
+ inline constexpr typename basic_string_view<CharT,Traits>::size_type
53
+ basic_string_view<CharT,Traits>::size()
54
+ const noexcept
55
+ {
56
+ return m_size;
57
+ }
58
+
59
+ template<typename CharT, typename Traits>
60
+ inline constexpr typename basic_string_view<CharT,Traits>::size_type
61
+ basic_string_view<CharT,Traits>::length()
62
+ const noexcept
63
+ {
64
+ return size();
65
+ }
66
+
67
+ template<typename CharT, typename Traits>
68
+ inline constexpr typename basic_string_view<CharT,Traits>::size_type
69
+ basic_string_view<CharT,Traits>::max_size()
70
+ const noexcept
71
+ {
72
+ return npos - 1;
73
+ }
74
+
75
+ template<typename CharT, typename Traits>
76
+ inline constexpr bool basic_string_view<CharT,Traits>::empty()
77
+ const noexcept
78
+ {
79
+ return m_size == 0;
80
+ }
81
+
82
+ //--------------------------------------------------------------------------
83
+ // Element Access
84
+ //--------------------------------------------------------------------------
85
+
86
+ template<typename CharT, typename Traits>
87
+ inline constexpr const typename basic_string_view<CharT,Traits>::char_type*
88
+ basic_string_view<CharT,Traits>::c_str()
89
+ const noexcept
90
+ {
91
+ return m_str;
92
+ }
93
+
94
+ template<typename CharT, typename Traits>
95
+ inline constexpr const typename basic_string_view<CharT,Traits>::char_type*
96
+ basic_string_view<CharT,Traits>::data()
97
+ const noexcept
98
+ {
99
+ return m_str;
100
+ }
101
+
102
+ template<typename CharT, typename Traits>
103
+ inline constexpr typename basic_string_view<CharT,Traits>::const_reference
104
+ basic_string_view<CharT,Traits>::operator[](size_type pos)
105
+ const noexcept
106
+ {
107
+ return m_str[pos];
108
+ }
109
+
110
+ template<typename CharT, typename Traits>
111
+ inline constexpr typename basic_string_view<CharT,Traits>::const_reference
112
+ basic_string_view<CharT,Traits>::at(size_type pos)
113
+ const
114
+ {
115
+ return pos < m_size ? m_str[pos] : throw std::out_of_range("Input out of range in basic_string_view::at"), m_str[pos];
116
+ }
117
+
118
+ template<typename CharT, typename Traits>
119
+ inline constexpr typename basic_string_view<CharT,Traits>::const_reference
120
+ basic_string_view<CharT,Traits>::front( )
121
+ const noexcept
122
+ {
123
+ return *m_str;
124
+ }
125
+
126
+ template<typename CharT, typename Traits>
127
+ inline constexpr typename basic_string_view<CharT,Traits>::const_reference
128
+ basic_string_view<CharT,Traits>::back( )
129
+ const noexcept
130
+ {
131
+ return m_str[m_size-1];
132
+ }
133
+
134
+ //--------------------------------------------------------------------------
135
+ // Modifiers
136
+ //--------------------------------------------------------------------------
137
+
138
+ template<typename CharT, typename Traits>
139
+ inline void
140
+ basic_string_view<CharT,Traits>::remove_prefix(size_type n)
141
+ noexcept
142
+ {
143
+ m_str += n, m_size -= n;
144
+ }
145
+
146
+ template<typename CharT, typename Traits>
147
+ inline void
148
+ basic_string_view<CharT,Traits>::remove_suffix(size_type n)
149
+ noexcept
150
+ {
151
+ m_size -= n;
152
+ }
153
+
154
+ template<typename CharT, typename Traits>
155
+ inline void
156
+ basic_string_view<CharT,Traits>::swap(basic_string_view& v)
157
+ noexcept
158
+ {
159
+ using std::swap;
160
+ swap(m_size,v.m_size);
161
+ swap(m_str,v.m_str);
162
+ }
163
+
164
+ //--------------------------------------------------------------------------
165
+ // Conversions
166
+ //--------------------------------------------------------------------------
167
+
168
+ template<typename CharT, typename Traits>
169
+ template<class Allocator>
170
+ inline constexpr std::basic_string<CharT, Traits, Allocator>
171
+ basic_string_view<CharT,Traits>::to_string(const Allocator& a)
172
+ const
173
+ {
174
+ return std::basic_string<CharT,Traits,Allocator>(m_str, m_size, a);
175
+ }
176
+
177
+ template<typename CharT, typename Traits>
178
+ template<class Allocator>
179
+ inline constexpr basic_string_view<CharT,Traits>::operator
180
+ std::basic_string<CharT, Traits, Allocator>()
181
+ const
182
+ {
183
+ return std::basic_string<CharT,Traits,Allocator>(m_str, m_size);
184
+ }
185
+
186
+ //--------------------------------------------------------------------------
187
+ // String Operations
188
+ //--------------------------------------------------------------------------
189
+
190
+ template<typename CharT, typename Traits>
191
+ inline typename basic_string_view<CharT,Traits>::size_type
192
+ basic_string_view<CharT,Traits>::copy(char_type* dest,
193
+ size_type count,
194
+ size_type pos)
195
+ const
196
+ {
197
+ if(pos >= m_size) {
198
+ throw std::out_of_range("Index out of range in basic_string_view::copy");
199
+ }
200
+
201
+ const size_type rcount = std::min(m_size - pos,count+1);
202
+ std::copy( m_str + pos, m_str + pos + rcount, dest);
203
+ return rcount;
204
+ }
205
+
206
+ template<typename CharT, typename Traits>
207
+ inline basic_string_view<CharT,Traits>
208
+ basic_string_view<CharT,Traits>::substr(size_type pos,
209
+ size_type len)
210
+ const
211
+ {
212
+ const size_type max_length = pos > m_size ? 0 : m_size - pos;
213
+
214
+ if (pos > size()) {
215
+ throw std::out_of_range("Index out of range in basic_string_view::substr");
216
+ }
217
+
218
+ return basic_string_view(m_str + pos, std::min(len, max_length) );
219
+ }
220
+
221
+ //--------------------------------------------------------------------------
222
+
223
+ template<typename CharT, typename Traits>
224
+ inline int basic_string_view<CharT,Traits>::compare(basic_string_view v)
225
+ const noexcept
226
+ {
227
+ const size_type rlen = std::min(m_size,v.m_size);
228
+ const int compare = Traits::compare(m_str,v.m_str,rlen);
229
+
230
+ return (compare ? compare : (m_size < v.m_size ? -1 : (m_size > v.m_size ? 1 : 0)));
231
+ }
232
+
233
+ template<typename CharT, typename Traits>
234
+ inline int basic_string_view<CharT,Traits>::compare(size_type pos,
235
+ size_type count,
236
+ basic_string_view v)
237
+ const
238
+ {
239
+ return substr(pos,count).compare(v);
240
+ }
241
+
242
+ template<typename CharT, typename Traits>
243
+ inline int basic_string_view<CharT,Traits>::compare(size_type pos1,
244
+ size_type count1,
245
+ basic_string_view v,
246
+ size_type pos2,
247
+ size_type count2)
248
+ const
249
+ {
250
+ return substr(pos1,count1).compare(v.substr(pos2,count2));
251
+ }
252
+
253
+ template<typename CharT, typename Traits>
254
+ inline int basic_string_view<CharT,Traits>::compare(const char_type* s)
255
+ const
256
+ {
257
+ return compare(basic_string_view<CharT,Traits>(s));
258
+ }
259
+
260
+ template<typename CharT, typename Traits>
261
+ inline int basic_string_view<CharT,Traits>::compare(size_type pos,
262
+ size_type count,
263
+ const char_type* s)
264
+ const
265
+ {
266
+ return substr(pos, count).compare(basic_string_view<CharT,Traits>(s));
267
+ }
268
+
269
+ template<typename CharT, typename Traits>
270
+ inline int basic_string_view<CharT,Traits>::compare(size_type pos,
271
+ size_type count1,
272
+ const char_type* s,
273
+ size_type count2)
274
+ const
275
+ {
276
+ return substr(pos, count1).compare(basic_string_view<CharT,Traits>(s, count2));
277
+ }
278
+
279
+ //--------------------------------------------------------------------------
280
+
281
+ template<typename CharT, typename Traits>
282
+ inline typename basic_string_view<CharT,Traits>::size_type
283
+ basic_string_view<CharT,Traits>::find(basic_string_view v,
284
+ size_type pos)
285
+ const
286
+ {
287
+ // Can't find a substring if the substring is bigger than this
288
+ if (pos > size()) {
289
+ return npos;
290
+ }
291
+ if ((pos + v.size()) > size()) {
292
+ return npos;
293
+ }
294
+
295
+ const auto offset = pos;
296
+ const auto increments = size() - v.size() - offset;
297
+
298
+ for (auto i = 0u; i <= increments; ++i) {
299
+ const auto j = i + offset;
300
+ if (substr(j, v.size()) == v) {
301
+ return j;
302
+ }
303
+ }
304
+ return npos;
305
+ }
306
+
307
+ template<typename CharT, typename Traits>
308
+ inline typename basic_string_view<CharT,Traits>::size_type
309
+ basic_string_view<CharT,Traits>::find(char_type c,
310
+ size_type pos)
311
+ const
312
+ {
313
+ return find(basic_string_view<CharT,Traits>(&c, 1), pos);
314
+ }
315
+
316
+ template<typename CharT, typename Traits>
317
+ inline typename basic_string_view<CharT,Traits>::size_type
318
+ basic_string_view<CharT,Traits>::find(const char_type* s, size_type pos,
319
+ size_type count)
320
+ const
321
+ {
322
+ return find(basic_string_view<CharT,Traits>(s, count), pos);
323
+ }
324
+
325
+ template<typename CharT, typename Traits>
326
+ inline typename basic_string_view<CharT,Traits>::size_type
327
+ basic_string_view<CharT,Traits>::find(const char_type* s,
328
+ size_type pos)
329
+ const
330
+ {
331
+ return find(basic_string_view<CharT,Traits>(s), pos);
332
+ }
333
+
334
+ //--------------------------------------------------------------------------
335
+
336
+ template<typename CharT, typename Traits>
337
+ inline typename basic_string_view<CharT,Traits>::size_type
338
+ basic_string_view<CharT,Traits>::rfind(basic_string_view v,
339
+ size_type pos)
340
+ const
341
+ {
342
+ if (empty()) {
343
+ return v.empty() ? 0u : npos;
344
+ }
345
+ if (v.empty()) {
346
+ return std::min(size() - 1, pos);
347
+ }
348
+ if (v.size() > size()) {
349
+ return npos;
350
+ }
351
+
352
+ auto i = std::min(pos, (size() - v.size()));
353
+ while (i != npos) {
354
+ if (substr(i, v.size()) == v) {
355
+ return i;
356
+ }
357
+ --i;
358
+ }
359
+
360
+ return npos;
361
+ }
362
+
363
+ template<typename CharT, typename Traits>
364
+ inline typename basic_string_view<CharT,Traits>::size_type
365
+ basic_string_view<CharT,Traits>::rfind(char_type c,
366
+ size_type pos)
367
+ const
368
+ {
369
+ return rfind(basic_string_view<CharT,Traits>(&c, 1), pos);
370
+ }
371
+
372
+ template<typename CharT, typename Traits>
373
+ inline typename basic_string_view<CharT,Traits>::size_type
374
+ basic_string_view<CharT,Traits>::rfind(const char_type* s, size_type pos,
375
+ size_type count)
376
+ const
377
+ {
378
+ return rfind(basic_string_view<CharT,Traits>(s, count), pos);
379
+ }
380
+
381
+ template<typename CharT, typename Traits>
382
+ inline typename basic_string_view<CharT,Traits>::size_type
383
+ basic_string_view<CharT,Traits>::rfind(const char_type* s,
384
+ size_type pos)
385
+ const
386
+ {
387
+ return rfind(basic_string_view<CharT,Traits>(s), pos);
388
+ }
389
+
390
+ //--------------------------------------------------------------------------
391
+
392
+ template<typename CharT, typename Traits>
393
+ inline typename basic_string_view<CharT,Traits>::size_type
394
+ basic_string_view<CharT,Traits>::find_first_of(basic_string_view v,
395
+ size_type pos)
396
+ const
397
+ {
398
+ const auto max_index = size();
399
+ for (auto i = pos; i < max_index; ++i) {
400
+ if (is_one_of(m_str[i],v)) {
401
+ return i;
402
+ }
403
+ }
404
+
405
+ return npos;
406
+ }
407
+
408
+ template<typename CharT, typename Traits>
409
+ inline typename basic_string_view<CharT,Traits>::size_type
410
+ basic_string_view<CharT,Traits>::find_first_of(char_type c,
411
+ size_type pos)
412
+ const
413
+ {
414
+ return find_first_of(basic_string_view<CharT,Traits>(&c, 1), pos);
415
+ }
416
+
417
+ template<typename CharT, typename Traits>
418
+ inline typename basic_string_view<CharT,Traits>::size_type
419
+ basic_string_view<CharT,Traits>::find_first_of(const char_type* s, size_type pos,
420
+ size_type count)
421
+ const
422
+ {
423
+ return find_first_of(basic_string_view<CharT,Traits>(s, count), pos);
424
+ }
425
+
426
+ template<typename CharT, typename Traits>
427
+ inline typename basic_string_view<CharT,Traits>::size_type
428
+ basic_string_view<CharT,Traits>::find_first_of(const char_type* s,
429
+ size_type pos)
430
+ const
431
+ {
432
+ return find_first_of(basic_string_view<CharT,Traits>(s), pos);
433
+ }
434
+
435
+ //--------------------------------------------------------------------------
436
+
437
+ template<typename CharT, typename Traits>
438
+ inline typename basic_string_view<CharT,Traits>::size_type
439
+ basic_string_view<CharT,Traits>::find_last_of(basic_string_view v,
440
+ size_type pos)
441
+ const
442
+ {
443
+ if (empty()) {
444
+ return npos;
445
+ }
446
+ const auto max_index = std::min(size() - 1, pos);
447
+ for (auto i = 0u; i <= max_index; ++i) {
448
+ const auto j = max_index - i;
449
+
450
+ if (is_one_of(m_str[j],v)) {
451
+ return j;
452
+ }
453
+ }
454
+
455
+ return npos;
456
+ }
457
+
458
+ template<typename CharT, typename Traits>
459
+ inline typename basic_string_view<CharT,Traits>::size_type
460
+ basic_string_view<CharT,Traits>::find_last_of(char_type c,
461
+ size_type pos)
462
+ const
463
+ {
464
+ return find_last_of(basic_string_view<CharT,Traits>(&c, 1), pos);
465
+ }
466
+
467
+ template<typename CharT, typename Traits>
468
+ inline typename basic_string_view<CharT,Traits>::size_type
469
+ basic_string_view<CharT,Traits>::find_last_of(const char_type* s, size_type pos,
470
+ size_type count)
471
+ const
472
+ {
473
+ return find_last_of(basic_string_view<CharT,Traits>(s, count), pos);
474
+ }
475
+
476
+ template<typename CharT, typename Traits>
477
+ inline typename basic_string_view<CharT,Traits>::size_type
478
+ basic_string_view<CharT,Traits>::find_last_of(const char_type* s,
479
+ size_type pos)
480
+ const
481
+ {
482
+ return find_last_of(basic_string_view<CharT,Traits>(s), pos);
483
+ }
484
+
485
+ //--------------------------------------------------------------------------
486
+
487
+ template<typename CharT, typename Traits>
488
+ inline typename basic_string_view<CharT,Traits>::size_type
489
+ basic_string_view<CharT,Traits>::find_first_not_of(basic_string_view v,
490
+ size_type pos)
491
+ const
492
+ {
493
+ const auto max_index = size();
494
+ for (auto i = pos; i < max_index; ++i) {
495
+ if (!is_one_of(m_str[i],v)) {
496
+ return i;
497
+ }
498
+ }
499
+
500
+ return npos;
501
+ }
502
+
503
+ template<typename CharT, typename Traits>
504
+ inline typename basic_string_view<CharT,Traits>::size_type
505
+ basic_string_view<CharT,Traits>::find_first_not_of(char_type c,
506
+ size_type pos)
507
+ const
508
+ {
509
+ return find_first_not_of(basic_string_view<CharT,Traits>(&c, 1), pos);
510
+ }
511
+
512
+ template<typename CharT, typename Traits>
513
+ inline typename basic_string_view<CharT,Traits>::size_type
514
+ basic_string_view<CharT,Traits>::find_first_not_of(const char_type* s,
515
+ size_type pos,
516
+ size_type count)
517
+ const
518
+ {
519
+ return find_first_not_of(basic_string_view<CharT,Traits>(s, count), pos);
520
+ }
521
+
522
+ template<typename CharT, typename Traits>
523
+ inline typename basic_string_view<CharT,Traits>::size_type
524
+ basic_string_view<CharT,Traits>::find_first_not_of(const char_type* s,
525
+ size_type pos)
526
+ const
527
+ {
528
+ return find_first_not_of(basic_string_view<CharT,Traits>(s), pos);
529
+ }
530
+
531
+ //--------------------------------------------------------------------------
532
+
533
+ template<typename CharT, typename Traits>
534
+ inline typename basic_string_view<CharT,Traits>::size_type
535
+ basic_string_view<CharT,Traits>::find_last_not_of(basic_string_view v,
536
+ size_type pos)
537
+ const
538
+ {
539
+ if (empty()) {
540
+ return npos;
541
+ }
542
+ const auto max_index = std::min(size() - 1, pos);
543
+ for (auto i = 0u; i <= max_index; ++i) {
544
+ const auto j = max_index - i;
545
+
546
+ if (!is_one_of(m_str[j],v)) {
547
+ return j;
548
+ }
549
+ }
550
+
551
+ return npos;
552
+ }
553
+
554
+ template<typename CharT, typename Traits>
555
+ inline typename basic_string_view<CharT,Traits>::size_type
556
+ basic_string_view<CharT,Traits>::find_last_not_of(char_type c,
557
+ size_type pos)
558
+ const
559
+ {
560
+ return find_last_not_of(basic_string_view<CharT,Traits>(&c, 1), pos);
561
+ }
562
+
563
+ template<typename CharT, typename Traits>
564
+ inline typename basic_string_view<CharT,Traits>::size_type
565
+ basic_string_view<CharT,Traits>::find_last_not_of(const char_type* s,
566
+ size_type pos,
567
+ size_type count)
568
+ const
569
+ {
570
+ return find_last_not_of(basic_string_view<CharT,Traits>(s, count), pos);
571
+ }
572
+
573
+ template<typename CharT, typename Traits>
574
+ inline typename basic_string_view<CharT,Traits>::size_type
575
+ basic_string_view<CharT,Traits>::find_last_not_of(const char_type* s,
576
+ size_type pos)
577
+ const
578
+ {
579
+ return find_last_not_of(basic_string_view<CharT,Traits>(s), pos);
580
+ }
581
+
582
+ //--------------------------------------------------------------------------
583
+ // Iterator
584
+ //--------------------------------------------------------------------------
585
+
586
+ template<typename CharT, typename Traits>
587
+ inline typename basic_string_view<CharT,Traits>::const_iterator
588
+ basic_string_view<CharT,Traits>::begin()
589
+ const noexcept
590
+ {
591
+ return m_str;
592
+ }
593
+
594
+ template<typename CharT, typename Traits>
595
+ inline typename basic_string_view<CharT,Traits>::const_iterator
596
+ basic_string_view<CharT,Traits>::cbegin()
597
+ const noexcept
598
+ {
599
+ return begin();
600
+ }
601
+
602
+ template<typename CharT, typename Traits>
603
+ inline typename basic_string_view<CharT,Traits>::const_iterator
604
+ basic_string_view<CharT,Traits>::end()
605
+ const noexcept
606
+ {
607
+ return m_str + m_size;
608
+ }
609
+
610
+ template<typename CharT, typename Traits>
611
+ inline typename basic_string_view<CharT,Traits>::const_iterator
612
+ basic_string_view<CharT,Traits>::cend()
613
+ const noexcept
614
+ {
615
+ return cend();
616
+ }
617
+
618
+ template<typename CharT, typename Traits>
619
+ inline typename basic_string_view<CharT,Traits>::const_reverse_iterator
620
+ basic_string_view<CharT,Traits>::rbegin()
621
+ const noexcept
622
+ {
623
+ return const_reverse_iterator{end()};
624
+ }
625
+
626
+ template<typename CharT, typename Traits>
627
+ inline typename basic_string_view<CharT,Traits>::const_reverse_iterator
628
+ basic_string_view<CharT,Traits>::crbegin()
629
+ const noexcept
630
+ {
631
+ return rbegin();
632
+ }
633
+
634
+ template<typename CharT, typename Traits>
635
+ inline typename basic_string_view<CharT,Traits>::const_reverse_iterator
636
+ basic_string_view<CharT,Traits>::rend()
637
+ const noexcept
638
+ {
639
+ return const_reverse_iterator{begin()};
640
+ }
641
+
642
+ template<typename CharT, typename Traits>
643
+ inline typename basic_string_view<CharT,Traits>::const_reverse_iterator
644
+ basic_string_view<CharT,Traits>::crend()
645
+ const noexcept
646
+ {
647
+ return crend();
648
+ }
649
+
650
+ template <typename CharT, typename Traits>
651
+ inline bool basic_string_view<CharT,Traits>::is_one_of(CharT c,
652
+ basic_string_view str)
653
+ {
654
+ for (auto s : str) {
655
+ if (c == s) {
656
+ return true;
657
+ }
658
+ }
659
+ return false;
660
+ }
661
+
662
+ //--------------------------------------------------------------------------
663
+ // Public Functions
664
+ //--------------------------------------------------------------------------
665
+
666
+ template<typename CharT, typename Traits>
667
+ std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& o,
668
+ const basic_string_view<CharT,Traits>& str)
669
+ {
670
+ o.write(str.data(),str.size());
671
+ return o;
672
+ }
673
+
674
+ template<typename CharT, typename Traits>
675
+ inline void swap(basic_string_view<CharT,Traits>& lhs,
676
+ basic_string_view<CharT,Traits>& rhs)
677
+ noexcept
678
+ {
679
+ lhs.swap(rhs);
680
+ }
681
+
682
+ //--------------------------------------------------------------------------
683
+ // Comparison Functions
684
+ //--------------------------------------------------------------------------
685
+
686
+ template<typename CharT, typename Traits>
687
+ inline bool operator==(const basic_string_view<CharT,Traits>& lhs,
688
+ const basic_string_view<CharT,Traits>& rhs)
689
+ noexcept
690
+ {
691
+ return lhs.compare(rhs) == 0;
692
+ }
693
+
694
+ template<typename CharT, typename Traits>
695
+ inline bool operator==(basic_string_view<CharT,Traits> lhs,
696
+ const CharT* rhs)
697
+ noexcept
698
+ {
699
+ return lhs == basic_string_view<CharT,Traits>(rhs);
700
+ }
701
+
702
+ template<typename CharT, typename Traits>
703
+ inline bool operator==(const CharT* lhs,
704
+ const basic_string_view<CharT,Traits>& rhs)
705
+ noexcept
706
+ {
707
+ return basic_string_view<CharT,Traits>(lhs) == rhs;
708
+ }
709
+
710
+ template<typename CharT, typename Traits, typename Allocator>
711
+ inline bool operator==(const std::basic_string<CharT,Traits,Allocator>& lhs,
712
+ const basic_string_view<CharT,Traits>& rhs)
713
+ {
714
+ return basic_string_view<CharT,Traits>(lhs) == rhs;
715
+ }
716
+
717
+ template<typename CharT, typename Traits, typename Allocator>
718
+ inline bool operator==(const basic_string_view<CharT,Traits>& lhs,
719
+ const std::basic_string<CharT,Traits,Allocator>& rhs)
720
+ {
721
+ return lhs == basic_string_view<CharT,Traits>(rhs);
722
+ }
723
+
724
+ //--------------------------------------------------------------------------
725
+
726
+ template<typename CharT, typename Traits>
727
+ inline bool operator!=(const basic_string_view<CharT,Traits>& lhs,
728
+ const basic_string_view<CharT,Traits>& rhs)
729
+ noexcept
730
+ {
731
+ return lhs.compare(rhs) != 0;
732
+ }
733
+
734
+ template<typename CharT, typename Traits>
735
+ inline bool operator!=(const basic_string_view<CharT,Traits>& lhs,
736
+ const CharT* rhs)
737
+ noexcept
738
+ {
739
+ return lhs != basic_string_view<CharT,Traits>(rhs);
740
+ }
741
+
742
+ template<typename CharT, typename Traits>
743
+ inline bool operator!=(const CharT* lhs,
744
+ const basic_string_view<CharT,Traits>& rhs)
745
+ noexcept
746
+ {
747
+ return basic_string_view<CharT,Traits>(lhs) != rhs;
748
+ }
749
+
750
+ template<typename CharT, typename Traits, typename Allocator>
751
+ inline bool operator!=(const std::basic_string<CharT,Traits,Allocator>& lhs,
752
+ const basic_string_view<CharT,Traits>& rhs)
753
+ {
754
+ return basic_string_view<CharT,Traits>(lhs) != rhs;
755
+ }
756
+
757
+ template<typename CharT, typename Traits, typename Allocator>
758
+ inline bool operator!=(const basic_string_view<CharT,Traits>& lhs,
759
+ const std::basic_string<CharT,Traits,Allocator>& rhs)
760
+ {
761
+ return lhs != basic_string_view<CharT,Traits>(rhs);
762
+ }
763
+ //--------------------------------------------------------------------------
764
+
765
+ template<typename CharT, typename Traits>
766
+ inline bool operator<(const basic_string_view<CharT,Traits>& lhs,
767
+ const basic_string_view<CharT,Traits>& rhs)
768
+ noexcept
769
+ {
770
+ return lhs.compare(rhs) < 0;
771
+ }
772
+
773
+ template<typename CharT, typename Traits>
774
+ inline bool operator<(const basic_string_view<CharT,Traits>& lhs,
775
+ const CharT* rhs)
776
+ noexcept
777
+ {
778
+ return lhs < basic_string_view<CharT,Traits>(rhs);
779
+ }
780
+
781
+ template<typename CharT, typename Traits>
782
+ inline bool operator<(const CharT* lhs,
783
+ const basic_string_view<CharT,Traits>& rhs)
784
+ noexcept
785
+ {
786
+ return basic_string_view<CharT,Traits>(lhs) < rhs;
787
+ }
788
+
789
+ template<typename CharT, typename Traits, typename Allocator>
790
+ inline bool operator<(const std::basic_string<CharT,Traits,Allocator>& lhs,
791
+ const basic_string_view<CharT,Traits>& rhs)
792
+ {
793
+ return basic_string_view<CharT,Traits>(lhs) < rhs;
794
+ }
795
+
796
+ template<typename CharT, typename Traits, typename Allocator>
797
+ inline bool operator<(const basic_string_view<CharT,Traits>& lhs,
798
+ const std::basic_string<CharT,Traits,Allocator>& rhs)
799
+ {
800
+ return lhs < basic_string_view<CharT,Traits>(rhs);
801
+ }
802
+
803
+ //--------------------------------------------------------------------------
804
+
805
+ template<typename CharT, typename Traits>
806
+ inline bool operator>(const basic_string_view<CharT,Traits>& lhs,
807
+ const basic_string_view<CharT,Traits>& rhs)
808
+ noexcept
809
+ {
810
+ return lhs.compare(rhs) > 0;
811
+ }
812
+
813
+ template<typename CharT, typename Traits>
814
+ inline bool operator>(const basic_string_view<CharT,Traits>& lhs,
815
+ const CharT* rhs)
816
+ noexcept
817
+ {
818
+ return lhs > basic_string_view<CharT,Traits>(rhs);
819
+ }
820
+
821
+ template<typename CharT, typename Traits>
822
+ inline bool operator>(const CharT* lhs,
823
+ const basic_string_view<CharT,Traits>& rhs)
824
+ noexcept
825
+ {
826
+ return basic_string_view<CharT,Traits>(lhs) > rhs;
827
+ }
828
+
829
+ template<typename CharT, typename Traits, typename Allocator>
830
+ inline bool operator>(const std::basic_string<CharT,Traits,Allocator>& lhs,
831
+ const basic_string_view<CharT,Traits>& rhs)
832
+ {
833
+ return basic_string_view<CharT,Traits>(lhs) > rhs;
834
+ }
835
+
836
+ template<typename CharT, typename Traits, typename Allocator>
837
+ inline bool operator>(const basic_string_view<CharT,Traits>& lhs,
838
+ const std::basic_string<CharT,Traits,Allocator>& rhs)
839
+ {
840
+ return lhs > basic_string_view<CharT,Traits>(rhs);
841
+ }
842
+
843
+ //--------------------------------------------------------------------------
844
+
845
+ template<typename CharT, typename Traits>
846
+ inline bool operator<=(const basic_string_view<CharT,Traits>& lhs,
847
+ const basic_string_view<CharT,Traits>& rhs)
848
+ noexcept
849
+ {
850
+ return lhs.compare(rhs) <= 0;
851
+ }
852
+
853
+ template<typename CharT, typename Traits>
854
+ inline bool operator<=(const basic_string_view<CharT,Traits>& lhs,
855
+ const CharT* rhs)
856
+ noexcept
857
+ {
858
+ return lhs <= basic_string_view<CharT,Traits>(rhs);
859
+ }
860
+
861
+ template<typename CharT, typename Traits>
862
+ inline bool operator<=(const CharT* lhs,
863
+ const basic_string_view<CharT,Traits>& rhs)
864
+ noexcept
865
+ {
866
+ return basic_string_view<CharT,Traits>(lhs) <= rhs;
867
+ }
868
+
869
+ template<typename CharT, typename Traits, typename Allocator>
870
+ inline bool operator<=(const std::basic_string<CharT,Traits,Allocator>& lhs,
871
+ const basic_string_view<CharT,Traits>& rhs)
872
+ {
873
+ return basic_string_view<CharT,Traits>(lhs) <= rhs;
874
+ }
875
+
876
+ template<typename CharT, typename Traits, typename Allocator>
877
+ inline bool operator<=(const basic_string_view<CharT,Traits>& lhs,
878
+ const std::basic_string<CharT,Traits,Allocator>& rhs)
879
+ {
880
+ return lhs <= basic_string_view<CharT,Traits>(rhs);
881
+ }
882
+
883
+ //--------------------------------------------------------------------------
884
+
885
+ template<typename CharT, typename Traits>
886
+ inline bool operator>=(const basic_string_view<CharT,Traits>& lhs,
887
+ const basic_string_view<CharT,Traits>& rhs)
888
+ noexcept
889
+ {
890
+ return lhs.compare(rhs) >= 0;
891
+ }
892
+
893
+ template<typename CharT, typename Traits>
894
+ inline bool operator>=(const basic_string_view<CharT,Traits>& lhs,
895
+ const CharT* rhs)
896
+ noexcept
897
+ {
898
+ return lhs >= basic_string_view<CharT,Traits>(rhs);
899
+ }
900
+
901
+ template<typename CharT, typename Traits>
902
+ inline bool operator>=(const CharT* lhs,
903
+ const basic_string_view<CharT,Traits>& rhs)
904
+ noexcept
905
+ {
906
+ return basic_string_view<CharT,Traits>(lhs) >= rhs;
907
+ }
908
+
909
+ template<typename CharT, typename Traits, typename Allocator>
910
+ inline bool operator>=(const std::basic_string<CharT,Traits,Allocator>& lhs,
911
+ const basic_string_view<CharT,Traits>& rhs)
912
+ {
913
+ return basic_string_view<CharT,Traits>(lhs) >= rhs;
914
+ }
915
+
916
+ template<typename CharT, typename Traits, typename Allocator>
917
+ inline bool operator>=(const basic_string_view<CharT,Traits>& lhs,
918
+ const std::basic_string<CharT,Traits,Allocator>& rhs)
919
+ {
920
+ return lhs >= basic_string_view<CharT,Traits>(rhs);
921
+ }
922
+
923
+ } // namespace bpstd
924
+
925
+ #endif /* BPSTD_DETAIL_STRING_VIEW_INL */