赞
踩
- // tooling.cpp
- export module cxx.fuck.u; // Exposed to consumers.
- import :details; // Consumers cannot import this module, internal only.
-
- export namespace tooling
- {
- class axxhole
- {
- public:
- axxhole() = default;
-
- inline operator std::string() { return "pretty"; }
-
- void feed()
- {
- details::feed_shit_impl(*this);
- }
- };
- }
-
-
- // tooling_details.cpp
- module cxx.fuck.u:details; // A module partition, for internal use only.
- import std.core;
-
- export namespace tooling::details
- {
- template<typename T>
- concept CastableToString = requires(T t)
- {
- { t }->std::string;
- };
-
- template<typename TTarget>
- void feed_shit_impl(TTarget&& target) requires CastableToString<TTarget>
- {
- auto name = static_cast<std::string>(std::forward<TTarget>(target));
- std::cout << "Feeding " << name << "... Delicious!" << std::endl;
- }
- }
-
- // Consumers
- import cxx.fuck.u;
-
- int main()
- {
- tooling::axxhole payload;
- payload.feed();
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。