Anarion's Profile User Rating: -----

Reputation: 287 Architect
Author w/DIC++
Active Posts:
1,469 (0.73 per day)
16-May 09
Profile Views:
Last Active:
User is offline 5 minutes ago

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   Anarion loves music more than ever :)

Posts I've Made

  1. In Topic: Problem Regarding Implementation Inheritance

    Posted 24 Nov 2014

    View PostCTphpnwb, on 25 November 2014 - 01:20 AM, said:

    It defines it, but for the base class. I think you need to use templates here, but I always seem to mess up inheritance when using them. :sadlike:

    Ah tell me about it! I have always had a bad feeling towards inheritance, now look how I got trapped again into it :dontgetit:
    After a little bit of testing, it turns out that the copy constructor is not working for the derived class as well. I think I read something wrong in my textbook, because from what I have read, this should be working fine because matrixcw is not adding any invariants...

    I agree with you that I should try templates. After all, it's only a part of the behavior that is changing. I am thinking about passing a function object as template argument right now.

    Will post the results back if it works elegantly this way :mellow: Let me know if you find something.

    Oh and thanks for helping me out my friend :)
  2. In Topic: Problem Regarding Implementation Inheritance

    Posted 24 Nov 2014

    View PostCTphpnwb, on 25 November 2014 - 01:05 AM, said:

    That code compiles and runs for me. Output:
    3 4
    10 12

    Yes, indeed. My problem is that I don't understand why it works now (that has the re-definition of operator+ in matrixcw) but does not work when I omit this re-definition. I expected it to work because the base class defines it already. There must be something I am missing here.

    Edit:Here is what I mean:
    class matrixcw: public matrix_base
        using matrix_base::matrix_base;
        iterator cbegin(const std::size_t&) override;
        iterator rbegin(const std::size_t&) override;
        //Right here, if you comment this out (along with it's definition)
        //the code does not compile
        friend matrixcw operator+(const matrixcw&, const matrixcw&);
        std::size_t linear_index(const std::size_t&, const std::size_t&) const override;
  3. In Topic: Problem Regarding Implementation Inheritance

    Posted 24 Nov 2014

    Pardon me for omitting the full implementation. Here are the files containing the re-implementation of operator+, don't forget the C++11 compiler tag: Attached File (2.61K)
    Number of downloads: 8
    Side note: Currently, the column-wise operations are dummy and a copy of the row-wise implementation. Also, the iterator is customized to satisfy the needs of my project, that's why they are a little bit weird :)
  4. In Topic: class <template> problem

    Posted 23 Nov 2014

    But as jimblumberg and sepp2k have noted, there really is no need to define such function in a class. It would be much more elegant if you had defined it as a templated ordinary function.

  5. In Topic: class <template> problem

    Posted 23 Nov 2014

    There are two problems that you are facing right now. First, you have to omit the repetition of static when you are defining a static member function outside a class. Second, when you are declaring a function inside a class and the definition is outside, you have to tell the compiler to use the template parameters somehow. You do this just like you did with the class:
    template <typename T>
    class swapp
        static void change(T& a, T& B)/>;
    //again, you have to declare the template parameter here,
    //so that the compiler can generate proper code
    //also notice that here we have no mention of static!
    //it's already done in the declaration.
    template <typename T>
    void swapp<T>::change(T& a, T& B)/> {
        T aux;
        aux = a;
        a = b;
        b = aux;

My Information

Member Title:
The Persian Coder
22 years old
May 17, 1992
Music Production, Tennis, Programming, KitKat, Cars, Bikes
Full Name:
Kian Nezhadfard
Years Programming:
Programming Languages:
Good At: C++, Linux

Contact Information



Page 1 of 1
  1. Photo

    Hybrid SyntaX Icon

    10 Feb 2014 - 14:02
  2. Photo

    estherNamogo Icon

    03 Nov 2013 - 06:33
    Nice to meet you write
    me at ( i will send you my picture OK.
  3. Photo

    jatinjindalj Icon

    06 Sep 2012 - 09:01
    Hey Regarding your code snippet at>
    Can you please explain:
    why when at line 37 and 38,If I do
    while(q!= NULL) {//Line 37
    q = q->link;
    t = new node;
    t->data = str;
    t->link = NULL;<...
  4. Photo

    Anarion Icon

    07 Aug 2012 - 06:23
    Thanks! I had made it for DIC Signature Contest and put it on my sig since then.
  5. Photo

    AnalyticLunatic Icon

    06 Aug 2012 - 09:05
    Just wanted to drop by and say Sweet Sig. Sometime I need to make one for myself.
  6. Photo

    David W Icon

    07 Jun 2012 - 00:31
    Shalom shalom my Regal Persian Coder Friend
  7. Photo

    Anarion Icon

    16 Mar 2011 - 00:56
    @abrsefid: ba arze sharmandegi, komaki az man sakhte nist. Az beine portha faghat ba USB kar kardam oon ham dar sathe kheili payin. Be shoma pishnahad mikonam baraye javabe soaletun dar internet jostejoo konid :)
  8. Photo

    yogesh201010 Icon

    05 Mar 2011 - 18:41
    hi i am yogesh
    how to connect internet by mob in linux.
    and tell me book for linux learning
  9. Photo

    abrsefid Icon

    27 Feb 2011 - 05:23
    salam man donbale 1 code c++ (ubuntu) migardam vase send o receive data ba port serial mishe rahnamaeem konid ?
  10. Photo

    hamishehiran Icon

    10 Aug 2010 - 23:02
    thanks for add! ;) nice to meet you!
  11. Photo

    Anarion Icon

    28 Mar 2010 - 08:27
    Thanks! Happy new year to you too :)
  12. Photo

    saSBH2 Icon

    28 Mar 2010 - 07:03
    Happy New Year :)
Page 1 of 1