[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-bugs
Subject:    [Bug 269261] kdevelop froze when i was typing
From:       Claudio Bantaloukas <rockdreamer () gmail ! com>
Date:       2011-07-21 7:50:41
Message-ID: E1Qjo1p-0003f7-72 () bugs ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=269261





--- Comment #5 from Claudio Bantaloukas <rockdreamer gmail com>  2011-07-21 07:50:40 ---
Hi, unfortunately it's not oss, so I can't give the exact source, but something
"similar" to the file I was working on ;)

If this does not trigger, I can send more, but I need to "cleanup" names and
sensitive data first... thanks!

#ifndef A_HPP
#define A_HPP
#include <boost/functional/hash.hpp>
#include <string>

namespace Comp {
namespace Prod {

struct A {
    std::string code;
    bool operator==(const A& rhs) const
    {
        return (code == rhs.code);
    }

};

std::size_t hash_value(A const& b)
{
    boost::hash<std::string> hasher;
    return hasher(b.code);
}

} // namespace Prod
} // namespace Comp

#endif // A_HPP


#ifndef B_HPP
#define B_HPP

#include <string>
#include <boost/flyweight.hpp>
#include <ostream>
#include "A.hpp"

namespace Comp {
namespace Prod {

struct B {
    std::string a;
    std::string b;
    std::string c;
    std::string d;
    std::string e;
    std::string f;
    std::string g;
    boost::flyweight<A> h;


    bool operator==(const B& rhs) const
    {
    if (h!=rhs.h)
      return false;
        if (!a.empty()) {
            return a == rhs.a;
        }
        if (!b.empty()) {
            return b == rhs.b;
        }
        return (c==rhs.c)&&(d==rhs.d)&&(e==rhs.e)&&(f==rhs.f);
    }

};

std::ostream & operator<<(std::ostream& out,const B& ins) {
    out << "B ";
    if (!ins.a.empty()) {
        out << "a["<< ins.a << "] ";
    }
    if (!ins.b.empty()) {
        out << "b["<< ins.b << "] ";
    }
    if (!ins.c.empty()) {
        out << "c["<< ins.c << "] ";
    }
    return out;
};

std::size_t hash_value(B const& b)
{
    std::size_t seed = 0;
    if (!b.g.get().code.empty()) {
        boost::hash_combine(seed, b.g.get().code);
    }
    if (!b.a.empty()) {
        boost::hash_combine(seed, b.a);
        return seed;
    }
    if (!b.b.empty()) {
        boost::hash_combine(seed, b.b);
        return seed;
    }

}

} // namespace Prod
} // namespace Comp

#endif // B_HPP

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

_______________________________________________
KDevelop-bugs mailing list
KDevelop-bugs@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic