Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8397217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:43:58+00:00 2026-06-09T20:43:58+00:00

By what have I to replace the missing line to have this CRTP solution

  • 0

By what have I to replace the missing line to have this CRTP solution working ?

template<class Crtp> class Base
{
    public:
        inline Crtp& operator=(const Base<Crtp>& rhs)
        {
            for (unsigned int i = 0; i < const_size; ++i) {
                _data[i] = rhs._data[i];
            }
            return /* SOMETHING HERE BUT WHAT ? */
        }

    protected:
        static const unsigned int const_size = 10;
        double _data[const_size];
};

class Derived : public Base<Derived>
{
};

Other question : does the solution you will provide has a cost at running time (compared to the solution where the operator is directly implemented in the derived class) ?

Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:43:59+00:00Added an answer on June 9, 2026 at 8:43 pm
    return static_cast<Crtp&>(*this);
    

    This has no cost at run time (but you might want to protect the constructor of Base).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have html-file. I have to replace all text between this: [%anytext%]. As I
I have following error: Error type - 2: preg_replace() [function.preg-replace]: Compilation failed: missing )
Hi I have been working on this code today after attempting some of the
I have a base class in one assembly and a large number of generated
I have to replace something in file with :something . My editor is kate
I have to replace a the backslash with the slash with a query in
I have tried to replace the submit button of a form with an ajax
I have been trying to replace a word in a text file with a
I have a pretty simple trigger: CREATE OR REPLACE FUNCTION f_log_datei() RETURNS TRIGGER AS
I have 2 types: CREATE OR REPLACE TYPE id_type AS OBJECT ( id NUMBER(19,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.