Forum Replies Created
-
AuthorPosts
-
::
Hi Rainer,
actually the video in this lesson: https://www.modernescpp.org/topics/example-lazyfutureonotherthread-cpp/ is also wrong.
It shows the same video as Example: lazyFuture.cpp.Thanx!
::Hi Rainer,
actually the video in this lesson: https://www.modernescpp.org/topics/example-startjobwithautomaticresumption-cpp/ is also wrong.
It shows the same video as Example: startJobWithComments.cpp.Thanx!
29. October 2023 at 22:13 in reply to: Difference between GCC and MSVC for floating non-type template parameters #63163029. October 2023 at 20:48 in reply to: Difference between GCC and MSVC for floating non-type template parameters #63162825. August 2023 at 11:53 in reply to: Constraint on template parameters vs compile time error #62955725. August 2023 at 11:16 in reply to: Constraint on template parameters vs compile time error #62955325. August 2023 at 10:46 in reply to: Constraint on template parameters vs compile time error #629551::Are you sure Rainer that SFINAE is used in this example? Because the std::advance does not use it:
template< class InputIt, class Distance > void advance( InputIt& it, Distance n ); template< class InputIt, class Distance > constexpr void advance( InputIt& it, Distance n );
I think the ADL kicks immediately in and behaves as you described above.
The John’s example would work even if we remove all of this advance methods: https://godbolt.org/z/scs3sK3vb because the calls will be forwards the std::advance.
::Hi,
I think you can still do this, if you need it, like in the example here: https://godbolt.org/z/oG38KxofY
You can have a default implementation in Base class and override it in the Derived one.
Both of these classes: Base and Derived must fulfill the requirements specified by concept, in this case providing the public method interface().::Hi Antonella,
here is a working version of your second (exampleWithoutExtraTemplateParam) example: https://godbolt.org/z/snnbfhzM6
::Thanx for your answer Rainer.
I think that was the main idea behind the consteval functions, keep it as a normal function at compile-time and avoid instantiations which happen for function templates.
Here I found an interesting discussion about this topic: https://www.reddit.com/r/cpp/comments/lxmv2z/allowing_parameters_of_consteval_function_to_be/
::Hi Fatih,
we are using the Boost::json in our product: https://www.boost.org/doc/libs/1_79_0/libs/json/doc/html/index.html
Maybe in your case you try to name/define the API of your InHouse implementation (almost) the same as boost library. So you can easily switch to it, or with less effort.
In case you want/must use your won implementation then the Adapter pattern would fit better.
::As far as I understood the abstraction class should have either a pointer or a reference (aka bridge) to the implementor class. And you have to tell somehow the abstraction class which implementor to instantiate, in case you have more than one implementor. So you can use the dependency injection for this (either via constructor or any member function) and I think this is the reason why the implementor is past as Ctor argument in bridge.cpp.
You don’t have this case in pimp.txt implementation because you have only one implementor class which is instantiated directly in the Ctor of class MyClass, and it is not exposed to the client.
If you take in consideration the examples: Refactoring Guru – Bridge you would see that in client code the TV instance is created and passed to the Abstraction RemoteControl. -
AuthorPosts