-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from cppfastio/master
- Loading branch information
Showing
3 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#pragma once | ||
|
||
namespace fast_io | ||
{ | ||
|
||
struct rw_type_tag_t | ||
{ | ||
explicit inline constexpr rw_type_tag_t() noexcept = default; | ||
}; | ||
|
||
inline constexpr rw_type_tag_t rw_type_tag{}; | ||
|
||
namespace details | ||
{ | ||
|
||
template<typename F> | ||
inline constexpr char const* write_some_contiguous_common_charptr_impl(F outstm,char const* first,char const* last) | ||
{ | ||
using char_type = typename F::char_type; | ||
if constexpr(requires() | ||
{ | ||
write_some_define(outstm,first,last); | ||
}) | ||
{ | ||
return write_some_define(outstm,first,last); | ||
} | ||
else if constexpr(requires() | ||
{ | ||
write_some_bytes_define(outstm,first,last); | ||
}) | ||
{ | ||
return write_some_bytes_define(outstm,first,last); | ||
} | ||
} | ||
|
||
template<typename F,typename char_type> | ||
inline constexpr char_type* write_some_contiguous_common_chtypeptr_impl(F outstm,char_type* first,char_type* last) | ||
{ | ||
using char_type = typename F::char_type; | ||
if constexpr(requires() | ||
{ | ||
write_some_define(outstm,first,last); | ||
}) | ||
{ | ||
return write_some_define(outstm,first,last); | ||
} | ||
else if constexpr(requires() | ||
{ | ||
|
||
}) | ||
{ | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
template<typename F,::std::forward_iterator Iter> | ||
inline constexpr Iter write_some(F&& foo,Iter first, Iter last) | ||
{ | ||
if constexpr(::std::contiguous_iterator<Iter>) | ||
{ | ||
|
||
} | ||
else | ||
{ | ||
if constexpr(requires() | ||
{ | ||
write_some_define(io_ref(foo),first,last); | ||
}) | ||
{ | ||
return write_some_define(io_ref(foo),first,last); | ||
} | ||
else if constexpr(requires() | ||
{ | ||
|
||
}) | ||
{ | ||
} | ||
else if constexpr(requires() | ||
{ | ||
write_all_define(io_ref(foo),first,last); | ||
}) | ||
{ | ||
write_all_define(io_ref(foo),first,last); | ||
return last; | ||
} | ||
else if constexpr(requires(::std::byte const* ptr) | ||
{ | ||
write_some_bytes_define(io_ref(foo),ptr,ptr); | ||
}) | ||
{ | ||
return write_some_bytes_define(io_ref(foo),first,last); | ||
} | ||
else if constexpr(requires(::std::byte const* ptr) | ||
{ | ||
write_all_bytes_define(io_ref(foo),ptr,ptr); | ||
}) | ||
{ | ||
return write_all_bytes_define(io_ref(foo),first,last); | ||
} | ||
} | ||
// io_ref() | ||
} | ||
/* | ||
template<typename Iter> | ||
//requires | ||
inline constexpr void write_all(Iter first,Iter last) | ||
{ | ||
} | ||
*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters