Skip to content

Commit

Permalink
Merge pull request #17 from cppfastio/master
Browse files Browse the repository at this point in the history
  • Loading branch information
havedifficultyinfindingnames committed May 2, 2023
2 parents 15c88ca + be1ea9c commit a83cae4
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 2 deletions.
114 changes: 114 additions & 0 deletions include/fast_io_core_impl/streamreflect.h
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)
{
}
*/

}
2 changes: 1 addition & 1 deletion include/fast_io_driver/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct timer
#endif
~timer()
{
perr(fast_io::u8err(),s, u8":", posix_clock_gettime(posix_clock_id::monotonic_raw)-t0,u8"s\n");
::fast_io::io::perr(fast_io::u8err(),s, u8":", posix_clock_gettime(posix_clock_id::monotonic_raw)-t0,u8"s\n");
}
};
}
2 changes: 1 addition & 1 deletion include/fast_io_driver/tsc_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct tsc_timer
#endif
~tsc_timer()
{
perr(fast_io::u8err(),s, u8":", current_tsc()-t0,u8" cycles\n");
::fast_io::io::perr(fast_io::u8err(),s, u8":", current_tsc()-t0,u8" cycles\n");
}
};

Expand Down

0 comments on commit a83cae4

Please sign in to comment.